summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-19 13:44:16 +0200
committerAki <nthirtyone@gmail.com>2016-05-19 13:44:16 +0200
commit2e10f4d16d37ade039cf0791603075ab489a654f (patch)
tree05106e025645999253412b7439c9c357f7682079
parent06ab90aeb91f4287adf3144778f72ee6a9b5f3c6 (diff)
downloadroflnauts-2e10f4d16d37ade039cf0791603075ab489a654f.zip
roflnauts-2e10f4d16d37ade039cf0791603075ab489a654f.tar.gz
roflnauts-2e10f4d16d37ade039cf0791603075ab489a654f.tar.bz2
Hit stops vertical movement
-rw-r--r--player.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/player.lua b/player.lua
index fd42260..85b106a 100644
--- a/player.lua
+++ b/player.lua
@@ -18,6 +18,7 @@ Player = {
max_velocity = 105,
combo = 1,
world = nil, -- game world
+ lives = 3,
-- Animation
animations = require "animations",
current = nil,
@@ -258,8 +259,6 @@ function Player:hit (horizontal, vertical)
end
if didHit then
n:damage(horizontal, vertical)
- n.combo = n.combo + 1
- print(n.combo)
end
end
end
@@ -268,6 +267,9 @@ end
-- Taking damage of `Player` by successful hit test
function Player:damage (horizontal, vertical)
self:createEffect("hit")
+ local x,y = self.body:getLinearVelocity()
+ self.body:setLinearVelocity(x,0)
self.body:applyLinearImpulse((34+12*self.combo)*horizontal, (50+10*self.combo)*vertical + 15)
self:changeAnimation("damage")
+ self.combo = math.min(10, self.combo + 1)
end \ No newline at end of file