Use the animation.loop class from the SDK, implement mid-animation reversal.
This commit is contained in:
parent
952bd63d73
commit
678207fd6d
2 changed files with 26 additions and 25 deletions
|
@ -46,11 +46,10 @@ local SPEED_SIZE_LOOKUP <const> = {
|
|||
|
||||
-- animations table
|
||||
local animations <const> = {
|
||||
defend=gfx.imagetable.new("images/kani/defend")
|
||||
defend=gfx.imagetable.new("images/kani/defend"),
|
||||
defend_reverse=gfx.imagetable.new("images/kani/defend_reverse"),
|
||||
}
|
||||
|
||||
|
||||
|
||||
class("Kani").extends(Entity)
|
||||
|
||||
function Kani:init(ui)
|
||||
|
@ -187,12 +186,12 @@ end
|
|||
|
||||
function Kani:onDefend()
|
||||
self.armor = 5
|
||||
self:animate(animations.defend, 500)
|
||||
self:animate(animations.defend, 50)
|
||||
end
|
||||
|
||||
function Kani:onDefendExit()
|
||||
self.armor = 0
|
||||
self:animate(animations.defend, 500, true)
|
||||
self:animate(animations.defend_reverse, 50, false, true)
|
||||
end
|
||||
|
||||
function Kani:runDefend()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue