Skip to content

Commit

Permalink
Add hp regeneration when shot hits
Browse files Browse the repository at this point in the history
  • Loading branch information
reggosaurus-reg committed Nov 10, 2019
1 parent 4c5662b commit fcb1d8d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ function love.update(dt)
end
end

-- check if any shot has hit an enemy
-- check if any shot has hit an enemy, regenerate HP!
for i, shot in pairs(shots) do
for j, enemy in pairs(enemies) do
if collision.collisionTest(shot.shape, enemy.shape) then
if curr_damage > 1 then
curr_damage = curr_damage - 1
end
sound_enemy_hit:play()
table.remove(shots, i)
table.remove(enemies, j)
Expand Down

0 comments on commit fcb1d8d

Please sign in to comment.