Switch animations for all actors in a scene?

Hello all! I'm hard at work on a game that I might release soon :) But one question...how could I switch animations for all actors in a scene? I want to switch all actors to a certain animations when a victory is earned, but I don't want to switch them one by one because I have at least 12+ on each scene at one time. I tried some stuff with lists which did nothing. Hep would be greatly, greatly appreciated!!! Thanks!!!  :)

NickamonPoppytail

  • *
  • Posts: 1098
Unfortunately, you may have to switch the animations for each actor one by one. You just need a “switch animation block” for each, then type in the animation names and select the actors in the scene. You could also create a behaviour for this, which is probably be your most efficient option.
Upcoming Projects
Poppytail 5 and Pixeltail: Fifth and sixth main instalments in Poppytail series. A Game About Trimming Hedges: Final Version: An updated version of the original AGATH. Easter Fun 2: A sequel to the original Easter Fun. One Million: Last-one-standing style small project. The Poppytales: RPG using characters from other stuff I've made/am making. Skies n' Fall: Boss rush shooter prequel to Rise n' Brawl.

merrak

  • *
  • Posts: 2527
There are some blocks in the Scene -> Actors palette, but if none of those will help then you might end up having to create a behavior like NickamonPoppytail suggested. A simple design would be to have a custom event, like "changeAnimationOnEnd".

When the scene ends, loop through every actor and trigger that event for all behaviors. It will execute for only the actors that have that behavior, which gives you control over which actors animation should change and which shouldn't.

I tried this with nothing happening in the scene upon the level being complete. See the code below; the first is in the scene, and determines when the level is done, the second is in the actor and upon receiving the level is done is supposed to switch animation. It doesn't work though, am I doing something wrong?  :P

YobApp

  • Posts: 57
Hey !
Try to use
For each ( Actor type )  block  Or for each (actor groupe)
choose your actor type then drop the switch animation in that block  dont forget to change self in switch animation by dragging the tag into it from the for each block !!

NickamonPoppytail

  • *
  • Posts: 1098
I tried this with nothing happening in the scene upon the level being complete. See the code below; the first is in the scene, and determines when the level is done, the second is in the actor and upon receiving the level is done is supposed to switch animation. It doesn't work though, am I doing something wrong?  :P

You can use the switch animation blocks in the scene’s code and then select each actor that you want to change the animation of. If you are creating actors in real time, you can also use attributes and place them into the switch animation blocks.
Upcoming Projects
Poppytail 5 and Pixeltail: Fifth and sixth main instalments in Poppytail series. A Game About Trimming Hedges: Final Version: An updated version of the original AGATH. Easter Fun 2: A sequel to the original Easter Fun. One Million: Last-one-standing style small project. The Poppytales: RPG using characters from other stuff I've made/am making. Skies n' Fall: Boss rush shooter prequel to Rise n' Brawl.