diff options
author | Aki <nthirtyone@gmail.com> | 2018-04-09 01:48:55 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2018-04-09 01:48:55 +0200 |
commit | 5ce7f80fcdbc16ed74d56865df3114a800b3788d (patch) | |
tree | 38d788fcba6992de8fdda801ec31c42f6660605a /not | |
parent | d900efc15b373d065666f891851085d70ec52667 (diff) | |
download | roflnauts-5ce7f80fcdbc16ed74d56865df3114a800b3788d.zip roflnauts-5ce7f80fcdbc16ed74d56865df3114a800b3788d.tar.gz roflnauts-5ce7f80fcdbc16ed74d56865df3114a800b3788d.tar.bz2 |
Walking animation start fires now inside Hero's onWalkingStarted
Diffstat (limited to 'not')
-rw-r--r-- | not/Hero.lua | 6 | ||||
-rw-r--r-- | not/Player.lua | 10 |
2 files changed, 6 insertions, 10 deletions
diff --git a/not/Hero.lua b/not/Hero.lua index 37e61c0..650eed4 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -169,7 +169,11 @@ end --- Called each time Hero starts walking. -- Is not called when only direction of walking is changed. function Hero:onWalkingStarted () - + if (self.current ~= self.animations.attack) and + (self.current ~= self.animations.attack_up) and + (self.current ~= self.animations.attack_down) then + self:setAnimation("walk") + end end function Hero:onJump () diff --git a/not/Player.lua b/not/Player.lua index 27ace75..c6c4431 100644 --- a/not/Player.lua +++ b/not/Player.lua @@ -42,15 +42,6 @@ function Player:controlpressed (set, action, key) if set ~= self:getControllerSet() then return end self.smoke = false -- TODO: temporary - -- Walking - if (action == "left" or action == "right") then - if (self.current ~= self.animations.attack) and - (self.current ~= self.animations.attack_up) and - (self.current ~= self.animations.attack_down) then - self:setAnimation("walk") - end - end - -- Punching if action == "attack" and self.punchCooldown <= 0 then local f = self.facing @@ -80,6 +71,7 @@ function Player:controlpressed (set, action, key) end end end + function Player:controlreleased (set, action, key) if set ~= self:getControllerSet() then return end -- Jumping |