despawn shots aggressively when offscreen

avoids hitting enemies before they spawn in.

may need to revisit this for the X coordinate if I want to implement a "Wild Ball" kind of weapon, but I think I won't have the tokens for that anyway
This commit is contained in:
2025-06-20 19:13:28 -07:00
parent 85c5091804
commit 99323be298

View File

@ -817,7 +817,7 @@ function bullet_base:move()
self.x += self.dx
self.y += self.dy
if (self.f) self.f -= 1
return (self.y > 145) or (self.y < -64) or (self.f and self.f < 0) or (self.x > 256) or (self.x < -128)
return (self.y > 130) or (self.y < -self.height*8) or (self.f and self.f < 0) or (self.x > 128) or (self.x < -self.width*8)
end
function bullet_base:draw()
@ -1761,7 +1761,6 @@ function xp_gem:draw()
end
function xp_gem:move()
if not primary_ship.dead and abs(self.x + 1 - primary_ship.x - primary_ship.hurt.x_off) <= primary_ship.magnet and abs(self.y + 1 - primary_ship.y - primary_ship.hurt.y_off) <= primary_ship.magnet then
if (self.x < primary_ship.x + 3) self.x += 1
if (self.x > primary_ship.x + 5) self.x -= 1
@ -1771,9 +1770,6 @@ function xp_gem:move()
return bullet_base.move(self)
end
-- todo: "magnetic" behavior
-- when near player ship
function xp_gem:hitship(ship)
if (ship ~= primary_ship or primary_ship.dead) return false
primary_ship.xp += self.val