From 2e10f4d16d37ade039cf0791603075ab489a654f Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 19 May 2016 13:44:16 +0200 Subject: Hit stops vertical movement --- player.lua | 6 ++++-- 1 file 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 -- cgit v1.1