It looks like you're new here. If you want to get involved, click one of these buttons!
local sprite local gtween local counter = 0 for i = 1, 100 do sprite = Bitmap.new(Texture.new("box.png")) stage:addChild(sprite) gtween = GTween.new(sprite, 0.1, {x = 240}, {delay = 0.1 * i, ease = easing.outBounce, repeatCount = 1, reflect = true}) gtween:addEventListener("complete", function(data) counter = counter + 1 print(data, counter) end, i) gtween.dispatchEvents = true end |
Comments
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
Though I had one question, if I nil the gtween handle, do I need to remove the eventListeners or would they automatically get removed as they are associated with the handle? To be on the safer side I do remove them, but Lua makes for some lazy programming, and this seems like work
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
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
And another situation is running multiple actions one by one on a sprite in short interval, it also will not work.
https://sites.google.com/site/xraystudiogame
and yes, maybe there is an issue with those many tweens thereby creating those many timers etc.
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
I can recommend removing "repeatCount = 1, reflect = true" from your code.
Also from our previous discussion, this code works well:
All boxes can move to the destination now.
https://sites.google.com/site/xraystudiogame
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Likes: Mells
Likes: zvardin
Likes: atilim
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