Serial and Parallel Tweens

harshhsrah

  • *
  • Posts: 68
If I have to do certain actions in a serial manner e.g.
1. click some actor
2. tween the actor (spin or slide) over time t1
3. After this tween is complete then show a popup using a slide and scale tween over time t2
4. Wait for time t3
5. After t3 slide out the popup  over time t4
6. After this tween is complete update some attributes and add/kill some actors

can all these be done as a serial tween where the next tween is triggered once the previous one is done?

or do I have to keep a track of t1, t2, t3, t4 .. and use the do after 't' seconds blocks in a nested manner?
Also if serial tweens are available then do we have an option for parallel tweens as well?


SadiQ

  • Posts: 1781
You must add code blocks if you want to serialize tweens. You can read about it on the Actuate Usage documentation
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

harshhsrah

  • *
  • Posts: 68
Thanks
I haven't tried code blocks yet..still new to Stencyl and most of the things that I need are available as blocks in the design mode.
So if I understand correctly, can I start using the Actuate library in Stencyl as is? Do you have any example of a code block using Actuate ?

for instance if I have have to do something after tween completes can I just have a code block that says

Actuate.tween (getLastCreatedActor(), 1, { alpha: 0 }).onComplete (DoSomething);
function DoSomething(){
     recycleActor(getLastCreatedActor)
}



SadiQ

  • Posts: 1781

So if I understand correctly, can I start using the Actuate library in Stencyl as is? Do you have any example of a code block using Actuate ?

for instance if I have have to do something after tween completes can I just have a code block that says

Actuate.tween (getLastCreatedActor(), 1, { alpha: 0 }).onComplete (DoSomething);
function DoSomething(){
     recycleActor(getLastCreatedActor)
}

Yes you can use the Actuate library as is, and the code you posted would work as long as the Actor instance that you get from getLastCreatedActor() has an alpha property.
You may need to add a Custom Code event in the scene for your DoSomething function, or you can simply inline the function inside the Actuate line:
Code: [Select]
Actuate.tween (getLastCreatedActor(), 1, { alpha: 0 }).onComplete (function()
    {
        recycleActor(getLastCreatedActor());
    });

Oh..you must also remember that stencyl uses an older version of Actuate, but as long as you're not interested in motion on a bezier path then you'll be ok.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

harshhsrah

  • *
  • Posts: 68
Thanks a lot...
I will give this a try