easing function is a great feature for making animation, it would be much better if it support to pass a callback function and parameter to be called after the animation finished. For examle, when an enemy died,it plays a dying animation then call a function to do some cleanup job
for examle:
local mc = MovieClip.new{
{1, 100, sprite1, {x = {0, 200, "linear"}, callback, parameter},
{50, 150, sprite1, {y = {0, 100, "linear"}, {alpha = {0, 1, "easeOut"}},
{100, 200, sprite2, {x = {0, 200, "linear"}},
}
and
GTween.new(sprite, 2, {x = 240}, {delay = 0.2, ease = easing.outBounce, repeatCount = 2, reflect = true}, callback, parameter)
or use a action sequence such as cocos2d
Comments
1. By giving onInit, onChange and onComplete parameters:
Thank you for suggestions
thank you
I got it
EventDispatcher is a greate feature.
does MovieClip dispatch some event after reach the specified frame
https://sites.google.com/site/xraystudiogame
local tween1 = GTween.new(...)
local tween2 = GTween.new(...)
tween1.nextTween = tween2
did you mean tween2 take place after tween1 is completed??
I wirte the following code
local tween = GTween.new(sprite, 0.1, {x = sprite:getX()+40}, {delay = 0, ease = easing.inoutElastic, repeatCount = 6, reflect = true})
local tween2 = GTween.new(sprite, 0.1, {alpha = 0}, {delay = 0, ease = easing.inoutElastic, repeatCount = 6, reflect = true})
tween.nextTween = tween2
I seems tween and tween2 take palce simultaneously,just the same as without the line "tween.nextTween = tween2"
https://sites.google.com/site/xraystudiogame
I've fixed a bug that can cause "invalid key to next"
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps