despawn projectiles offscreen

This commit is contained in:
yuki 2025-11-11 23:20:47 -03:00
parent 6a251b3619
commit 8be9c21ba2

View file

@ -30,6 +30,12 @@ function Projectile:update(dt)
-- move collision area -- move collision area
self.collider:moveTo(self.x, self.y) self.collider:moveTo(self.x, self.y)
-- offscreen despawn
if self.x < 0 then self:kill() end
if self.y < 0 then self:kill() end
if self.x > gw then self:kill() end
if self.y > gh then self:kill() end
end end
---Draws Projectile ---Draws Projectile