Hello!
I am using Director, and SpriteGrabber to organize my app, and control sprite playback.
Here is the situation:
I have a ‘dance’ animation with two stages. a ‘predance’ which is the character moving from a standing position to the dance position, and then a ‘dance’ stage that will loop continuously.
My question is, what is the best way to transition between these two stages? If I just line up two events like
boy:playClip("predance")
boy:playClip("dance")
it immediately jumps to the dancing animation. I assume I need to set up a listener to catch the ending of the first animation? or just a timer set to the same time as the duration of the first animation?
Thanks for any help!
Also, if you aren’t familiar:
Director: http://developer.anscamobile.com/code/director-class-10
SpriteGrabber: http://developer.anscamobile.com/code/spritegrabber-spritesheets-two-lines [import]uid: 13801 topic_id: 5908 reply_id: 305908[/import]
So create a series of functions to call the animations, and time them with event timers? Huh. I guess I thought there would be something easier.
Thanks for your help! I appreciate it! [import]uid: 13801 topic_id: 5908 reply_id: 20517[/import]
um, did you even read the link I posted? That’s not a timer, that’s how to set an event listener for when the sprite finishes playing its animation. [import]uid: 12108 topic_id: 5908 reply_id: 20667[/import]
Oops! Yes! I read them, but I was also reading a reply from Magenda on the Code Exchange page for SpriteGrabber, and mixed up my terms!
Sorry about that, I didn’t mean to sound like I wasn’t listening. I am actually doing it the way suggested by your link, and its working beautifully!
local boySheet = grabber.grabSheet("boy-largedance")
local boy = boySheet:grabSprite("", true, { predance={1,4,300,1}, dance={5, 7, 700, 0}})
boy:show(180, 180, 1, c)
localGroup:insert(boy)
local function predancestop( event )
if event.phase == "end" then
boy:playClip("dance")
end
end
boy:playClip("predance") --Starts the Predance Animation
boy:addEventListener("sprite", predancestop) --Listens for the end, and then starts the 'Dance' animation, which loops Fo' Eva'!
Thanks again! Sorry for adding confusion! [import]uid: 13801 topic_id: 5908 reply_id: 20681[/import]
This is an alternative solution to a problem I have at the moment. Thanks. If you can pardon this noob question… Can this work for a series of movieclips? [import]uid: 49324 topic_id: 5908 reply_id: 34048[/import]