Yeah this is my first post. And the subject might be a little unclear. The problem is that if like three or four "bullets" hit the enemy, the enemy sort of freezes in place instead of just being constantly pushed back. But this is my bullet collide with enemy code:
[size=85]
function bullet_collision(dt)
for i,v in ipairs(bullet) do
if enemy.x > v.x or
enemy.y < v.y + v.height and
enemy.y > v.y and
enemy.y + enemy.img:getHeight() < v.y and
enemy.y + enemy.img:getHeight() > v.y + v.height then
enemy.y = -100
sound:play()
end
if enemy.y > v.y or
enemy.x < v.x + v.width and
enemy.x > v.x and
enemy.x + enemy.img:getWidth() < v.x and
enemy.x + enemy.img:getWidth() > v.x + v.width then
enemy.y = -100
sound:play()
end
if enemy.y < 0 then
enemy.y = enemy.y + enemy.speed * dt
end
end
end
[/size]
And in case it's the enemy movement code. Here it is:
[size=85]
function enemy_move(dt)
if enemy.y < 0 then
enemy.y = enemy.y + enemy.speed * dt
end
if enemy.y < 720 then
enemy.y = enemy.y + enemy.speed * dt
end
if enemy.y > 720 then
enemy.y = -100
enemy.x = love.math.random(0, 1280)
end
end
[/size]
Thank you for your help, if you do try the .love just know it's not the finished version and the images are just some I had on my computer that I use for testing.