From 5ce7f80fcdbc16ed74d56865df3114a800b3788d Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 9 Apr 2018 01:48:55 +0200 Subject: Walking animation start fires now inside Hero's onWalkingStarted --- not/Hero.lua | 6 +++++- 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 -- cgit v1.1