kill player offscreen
This commit is contained in:
parent
8be9c21ba2
commit
7e24a44617
1 changed files with 6 additions and 0 deletions
|
|
@ -53,6 +53,12 @@ function Player:update(dt)
|
||||||
-- move collision area
|
-- move collision area
|
||||||
self.collider:moveTo(self.x, self.y)
|
self.collider:moveTo(self.x, self.y)
|
||||||
|
|
||||||
|
-- offscreen kill
|
||||||
|
if self.x < 0-self.w then self:kill() end
|
||||||
|
if self.y < 0-self.h then self:kill() end
|
||||||
|
if self.x > gw+self.w then self:kill() end
|
||||||
|
if self.y > gh+self.h then self:kill() end
|
||||||
|
|
||||||
if input:pressed('f11') then self:kill() end
|
if input:pressed('f11') then self:kill() end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue