summaryrefslogtreecommitdiffhomepage
path: root/player.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-22 16:29:12 +0200
committerAki <nthirtyone@gmail.com>2016-05-22 16:29:12 +0200
commitbbee57ad4fbb9a12c5e3947fcee68657d0fa52c5 (patch)
treef6435fb85afb221688cb802bc90664d10a9a48b9 /player.lua
parentb9fd32317e2af74ab6c9fb410666c26793d4f7a6 (diff)
downloadroflnauts-bbee57ad4fbb9a12c5e3947fcee68657d0fa52c5.zip
roflnauts-bbee57ad4fbb9a12c5e3947fcee68657d0fa52c5.tar.gz
roflnauts-bbee57ad4fbb9a12c5e3947fcee68657d0fa52c5.tar.bz2
Map loads from file
Diffstat (limited to 'player.lua')
-rw-r--r--player.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/player.lua b/player.lua
index abaf37d..7eb5f53 100644
--- a/player.lua
+++ b/player.lua
@@ -149,8 +149,9 @@ function Player:update (dt)
-- # DEATH
-- We all die in the end.
- if (self.body:getX() < -600 or self.body:getX() > 780 or
- self.body:getY() < -500 or self.body:getY() > 500) and
+ local m = self.world.map
+ if (self.body:getX() < m.center_x - m.width*1.5 or self.body:getX() > m.center_x + m.width*1.5 or
+ self.body:getY() < m.center_y - m.height*1.5 or self.body:getY() > m.center_y + m.height*1.5) and
self.alive
then
self:die()
@@ -349,7 +350,7 @@ end
function Player:respawn ()
self.alive = true
self.body:setLinearVelocity(0,0)
- self.body:setPosition(290/2, 180/2-80)
+ self.body:setPosition(self.world:getSpawnPosition())
self.body:setActive(true)
self:createEffect("respawn")
self:changeAnimation("idle")