diff options
| author | 1029chris <1029chris@gmail.com> | 2022-02-02 19:34:15 -0800 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2022-02-02 19:34:15 -0800 |
| commit | f142a571a3587846f666b2fc4a8ad4cb296c6ad6 (patch) | |
| tree | 1d0ac9185d4b422678985ab40bfdb605e867cf85 /players.lua | |
| parent | 80f39c08a0b6195088d38888b71825203d038902 (diff) | |
basic enemies and other stuff!!!!!!!
Diffstat (limited to 'players.lua')
| -rw-r--r-- | players.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/players.lua b/players.lua index d5da525..ae9ee96 100644 --- a/players.lua +++ b/players.lua @@ -1,7 +1,7 @@ playercount = -1 players = {} -function addplayer() +function addplayer(sprite, bulletsprite) playercount += 1 local player = {} player.health = 3 @@ -9,6 +9,8 @@ function addplayer() player.y = 60 player.w = 8 player.h = 8 + player.sprite = sprite + player.bulletsprite = bulletsprite player.ymov = 0 player.inv = -1 player.id = playercount @@ -20,11 +22,11 @@ function addplayer() print(player.health) if player.inv < 0 or ceil(player.inv*10%2) == 1 then if (player.ymov == 0) then - spr(2, player.x, player.y) + spr(player.sprite, player.x, player.y) elseif (player.ymov == 1) then - spr(3, player.x, player.y) + spr(player.sprite+1, player.x, player.y) elseif (player.ymov == -1) then - spr(3, player.x, player.y, 1, 1, false, true) + spr(player.sprite+1, player.x, player.y, 1, 1, false, true) end end end @@ -64,6 +66,9 @@ function addplayer() if player.particlecooldown < 0 then addcircle(player.x-1, player.y, -0.5, 0, 1.5, 0.5, 9) addcircle(player.x-1, player.y+7, -0.5, 0, 1.5, 0.5, 9) + if (player.health == 1) then + addcircle(player.x+rnd(8), player.y+rnd(8), -0.5, -0.2, rnd(8), rnd(1.5)+1, 5) + end player.particlecooldown = 0.1 end @@ -74,7 +79,7 @@ function addplayer() --for i = 1, 4, 1 do --addcircle(player.x+3, player.y+4, rnd(1)+0.5, rnd(1)-0.5, 1.5, rnd(0.4), 12) --end - addbullet(player.x+3, player.y, 2, 0, false) + addbullet(player.x+3, player.y, 2, 0, false, player.bulletsprite) player.shootcooldown = 0.1 end end @@ -82,4 +87,4 @@ function addplayer() add(players, player) end -addplayer()
\ No newline at end of file +addplayer(2, 6)
\ No newline at end of file |
