Managing flash animations for a game
Posted
by
LoveMeSomeCode
on Game Development
See other posts from Game Development
or by LoveMeSomeCode
Published on 2011-02-10T22:29:12Z
Indexed on
2011/02/10
23:34 UTC
Read the original article
Hit count: 354
Ok, I've been writing C# for a while, but I'm new to ActionScript, so this is a question about best practices.
We're developing a simple match game, where the user selects tiles and tries to match various numbers - sort of like memory - and when the match is made we want a series of animations to take place, and when they're done, remove the tile and add a new one.
So basically it's:
- User clicks the MC
- Animation 1 on the MC starts
- Animation 1 ends
- Remove the MC from the stage
- Add a new MC
- Start the animation on the new MC
The problem I run into is that I don't want to make the same timeline motion tween on each and every tile, when the animation is all the same. It's just the picture in the tile that's different.
The other method I've come up with is to just apply the tweens in code on the main stage. Then I attach an event handler for MOTION_FINISH, and in that handler I trigger the next animation and listen for that to finish etc. This works too, but not only do I have to do all the tweening in code, I have a seperate event handler for each stage of the animation.
So is there a more structured way of chaining these animations together?
© Game Development or respective owner