summaryrefslogtreecommitdiffhomepage
path: root/player.lua
diff options
context:
space:
mode:
Diffstat (limited to 'player.lua')
-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