diff options
author | Aki <nthirtyone@gmail.com> | 2017-07-18 06:39:05 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-07-18 06:39:05 +0200 |
commit | b6aad58259b1e71913280d30e2c9dbf4ecf264c3 (patch) | |
tree | b127adb3025559dc23f2d66cdd8758a68ce711b1 /not/Hero.lua | |
parent | 7ad366dcec68c703499e3f6f72b345d1adeac1da (diff) | |
download | roflnauts-b6aad58259b1e71913280d30e2c9dbf4ecf264c3.zip roflnauts-b6aad58259b1e71913280d30e2c9dbf4ecf264c3.tar.gz roflnauts-b6aad58259b1e71913280d30e2c9dbf4ecf264c3.tar.bz2 |
Removed obsolete punchdir and reworked physical animations on punches
Diffstat (limited to 'not/Hero.lua')
-rw-r--r-- | not/Hero.lua | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/not/Hero.lua b/not/Hero.lua index ff07c36..d9b0636 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -3,8 +3,6 @@ -- Collision category: [2] Hero = require "not.PhysicalBody":extends() --- Combat -Hero.punchdir = 0 -- a really bad thing -- Movement Hero.jumpTimer = 0.16 Hero.jumpCounter = 2 @@ -127,17 +125,14 @@ function Hero:update (dt) end -- Stop vertical - local c,a = self.current, self.animations - if (c == a.attack_up or c == a.attack_down or c == a.attack) and self.frame < c.frames then - if self.punchdir == 0 then - self:setLinearVelocity(0,0) - else - self:setLinearVelocity(38*self.facing,0) + local currentAnimation = self:getAnimation() + if self.frame < currentAnimation.frames then + if currentAnimation == self.animations.attack_up or currentAnimation == self.animations.attack_down then + self:setLinearVelocity(0, 0) + end + if currentAnimation == self.animations.attack then + self:setLinearVelocity(38*self.facing, 0) end - end - - if self.punchCooldown <= 0 and self.punchdir == 1 then - self.punchdir = 0 end end |