summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-20 19:57:49 +0200
committerAki <nthirtyone@gmail.com>2016-05-20 19:57:49 +0200
commit4c6c37c3f67048f2dda4d6051142b0381ecaa81e (patch)
tree07acf646394e5cd77762e081e797d52bca097c4c
parentea6a6856bfdd98524c2ec4cf52e5c926a31f9697 (diff)
downloadroflnauts-4c6c37c3f67048f2dda4d6051142b0381ecaa81e.zip
roflnauts-4c6c37c3f67048f2dda4d6051142b0381ecaa81e.tar.gz
roflnauts-4c6c37c3f67048f2dda4d6051142b0381ecaa81e.tar.bz2
Death is more deadly now
-rw-r--r--player.lua11
-rw-r--r--world.lua20
2 files changed, 21 insertions, 10 deletions
diff --git a/player.lua b/player.lua
index 0e8031e..4ed62e8 100644
--- a/player.lua
+++ b/player.lua
@@ -23,7 +23,7 @@ Player = {
spawntimer = 0,
alive = true,
punchcd = 0,
- punchinitial = 0.28,
+ punchinitial = 0.25,
punchdir = 0,
-- Animation
animations = require "animations",
@@ -42,7 +42,7 @@ Player = {
key_right = "right",
key_up = "up",
key_down = "down",
- key_hit = "return" -- don't ask
+ key_hit = "return"
}
-- Constructor of `Player`
@@ -307,6 +307,11 @@ function Player:hit (horizontal, vertical)
end
end
+-- Hittest
+function Player:testHit (caller, direction)
+
+end
+
-- Taking damage of `Player` by successful hit test
function Player:damage (horizontal, vertical)
self:createEffect("hit")
@@ -324,6 +329,7 @@ function Player:die ()
self.alive = false
self.spawntimer = 1
self.world.camera:startShake()
+ self.body:setActive(false)
end
-- And then respawn. Like Jon Snow.
@@ -331,6 +337,7 @@ function Player:respawn ()
self.alive = true
self.body:setLinearVelocity(0,0)
self.body:setPosition(290/2, 180/2-80)
+ self.body:setActive(true)
self:createEffect("respawn")
self:changeAnimation("idle")
end \ No newline at end of file
diff --git a/world.lua b/world.lua
index 470ccb6..da89755 100644
--- a/world.lua
+++ b/world.lua
@@ -172,17 +172,21 @@ end
-- beginContact
function World.beginContact(a, b, coll)
- local x,y = coll:getNormal()
- if y == -1 then
- print(b:getUserData().name .. " is not in air")
- b:getUserData().inAir = false
- b:getUserData().jumpdouble = true
- b:getUserData():createEffect("land")
+ if a:getCategory() == 1 then
+ local x,y = coll:getNormal()
+ if y == -1 then
+ print(b:getUserData().name .. " is not in air")
+ b:getUserData().inAir = false
+ b:getUserData().jumpdouble = true
+ b:getUserData():createEffect("land")
+ end
end
end
-- endContact
function World.endContact(a, b, coll)
- print(b:getUserData().name .. " is in air")
- b:getUserData().inAir = true
+ if a:getCategory() == 1 then
+ print(b:getUserData().name .. " is in air")
+ b:getUserData().inAir = true
+ end
end \ No newline at end of file