Difference between revisions of "Animations With Movieclip"
From GiderosMobile
(Created page with "'''Note:''' Currently there’s no way to set the animation speed, however you can prepare different animations for different speeds like: <source lang="lua"> local eliAnim =...") |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
'''Note:''' Currently there’s no way to set the animation speed, however you can prepare different animations for different speeds like: | '''Note:''' Currently there’s no way to set the animation speed, however you can prepare different animations for different speeds like: | ||
− | < | + | <syntaxhighlight lang="lua"> |
local eliAnim = MovieClip.new{ | local eliAnim = MovieClip.new{ | ||
{1, 7, self.anim[1]}, | {1, 7, self.anim[1]}, | ||
Line 12: | Line 12: | ||
eliAnim:gotoAndPlay(1) --> play slow animation | eliAnim:gotoAndPlay(1) --> play slow animation | ||
eliAnim:gotoAndPlay(16) --> play fast animation | eliAnim:gotoAndPlay(16) --> play fast animation | ||
− | </ | + | </syntaxhighlight> |
This way, you can position your MovieClip wherever you want (e.g running player, walking player, flying helicopter, etc). | This way, you can position your MovieClip wherever you want (e.g running player, walking player, flying helicopter, etc). |
Latest revision as of 17:08, 12 July 2023
Note: Currently there’s no way to set the animation speed, however you can prepare different animations for different speeds like:
local eliAnim = MovieClip.new{
{1, 7, self.anim[1]},
{8, 15, self.anim[2]},
{16, 18, self.anim[1]},
{19, 21, self.anim[2]},
}
eliAnim:setGotoAction(15, 1) --> frames 1-15: slow animation
eliAnim:setGotoAction(21, 16) --> frames 16-21: fast animation
eliAnim:gotoAndPlay(1) --> play slow animation
eliAnim:gotoAndPlay(16) --> play fast animation
This way, you can position your MovieClip wherever you want (e.g running player, walking player, flying helicopter, etc).