summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--not/Hero.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/not/Hero.lua b/not/Hero.lua
index 7ef7b4e..37e61c0 100644
--- a/not/Hero.lua
+++ b/not/Hero.lua
@@ -122,6 +122,16 @@ function Hero:update (dt)
end
end
+ --- Walking
+ -- TODO: Walking is still not satisfactiory. Think of way to improve it.
+ if self:isWalking() then
+ if not self._already_walking then
+ self._already_walking = true
+ self:onWalkingStarted()
+ end
+ else
+ self._already_walking = false
+ end
if self:isWalkingLeft() then
self:walk(-1)
end
@@ -156,6 +166,12 @@ function Hero:update (dt)
end
end
+--- Called each time Hero starts walking.
+-- Is not called when only direction of walking is changed.
+function Hero:onWalkingStarted ()
+
+end
+
function Hero:onJump ()
-- Start salto if last jump
if self.jumpCounter == 1 then