I am making a Zombie shoot-em-up game. I created a Zombi symbol with the default Zombie sprite. Inside the symbol I placed three more sprites that are ZombiAttack, ZombiIdle, and ZombiMove, in the frames 1, 15 and 20 respectively. I further converted the sprites to symbols and inside their respective symbols I placed the remaining sprites. So it’s like this:
- Zombi (Main Symbol):
-
ZombiAttack (in Frame 1): inside this I placed the remaining Zombie Attack sprites placed at intervals of 5 frames.
-
ZombiIdle (in Frame 15): inside this I placed the remaining Zombie Idle sprites placed at intervals of 5 frames.
-
ZombiMove (in Frame 20): inside this I placed the remaining Zombie Move sprites placed at intervals of 5 frames.
In the Zombi Class File I used the following code in the ENTER_FRAME listener’s function:
this.gotoAndPlay(20); //For the moving animation of the Zombie.
This plays a static image of the frame 20 and not what’s inside it (which I want it to play).
Now, my question is how do I do that? How do I play the nested symbols animation and control it further?
I am calculating the distance of the Zombie sprite from the player and if it is above the limit, I want the “ZombiMove” animation to play else it should play the attack animation “ZombiAttack”.
I’ve found a few posts that address a similar problem but the solution for them isn’t working for me as many posts were dated back to 2004 and 2005 and deal with AS2. (I don’t know AS2)
Also, I am creating all the movie clips during runtime using AS3. The Zombie sprites as well are generated randomly outside of the screen and then proceed towards the player.
Thanks in advance!