diff options
author | Aki <nthirtyone@gmail.com> | 2018-04-09 01:42:34 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2018-04-09 01:42:34 +0200 |
commit | d900efc15b373d065666f891851085d70ec52667 (patch) | |
tree | 9a3027c9d0e784bf16cb05e2d1bdc328066d98d9 | |
parent | ea62ce8ec8ae07ff6d421b4146d2503ef0f67574 (diff) | |
download | roflnauts-d900efc15b373d065666f891851085d70ec52667.zip roflnauts-d900efc15b373d065666f891851085d70ec52667.tar.gz roflnauts-d900efc15b373d065666f891851085d70ec52667.tar.bz2 |
Added method call when Hero starts walking
-rw-r--r-- | not/Hero.lua | 16 |
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 |