Main Menu


Sponsored Links

  


  
  

Tutorial - Synchronizing Actions

There are 2 macro defined in Web Cartoon Maker to help you to synchronize actions. These are THIS_TIME and SAME_TIME. Some methods and functions like GoesTo () or Winks() and all Change...() methods and functions can change the current time in scene. For example a boy in the script below first moves to a new location and then raises his hand and then winks:

#include <boy.h>

void Scene1 ()
{
    Boy Max;
    Max.SetPos ( 300, 290 );
    Max.SetVisible ();

    Max.ChangePos ( -300, 290, 2 );
    Max.RightArm.ChangeAngle ( 65, 2 );
    Max.Winks ();
}

But what if we want these 3 things to happen together? You can use GetTime () and SetTime () of course:

#include <boy.h>

void Scene1 ()
{
    Boy Max;
    Max.SetPos ( 300, 290 );
    Max.SetVisible ();

    double dStartTime = GetTime ();

    Max.ChangePos ( -300, 290, 2 );
    SetTime ( dStartTime );
    Max.RightArm.ChangeAngle ( 65, 2 );
    SetTime ( dStartTime );
    Max.Winks ();
}

But it is not very convenient. There is a more convenient way to use THIS_TIME before first action and SAME_TIME before other actions happening at the same time:

#include <boy.h>

void Scene1 ()
{
    Boy Max;
    Max.SetPos ( 300, 290 );
    Max.SetVisible ();

    double dStartTime = GetTime ();

    THIS_TIME Max.ChangePos ( -300, 290, 2 );
    SAME_TIME Max.RightArm.ChangeAngle ( 65, 2 );
    SAME_TIME Max.Winks ();
}

At the end of this tutorial please compile the above script and preview it in WCM Player

previous topic next topic

  
News

New Tales Animator Video by Alan Sturgess

Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi

...

Simple Online Character Designer

There is a prototype of simple online character designer available HERE. It is only a prototype, it does not contain many pieces yet but it can already generat

...

Book is updated

Now our book "Web Cartoon Maker: A Fun Way to Learn C++" is fully in synch with WCM 1.5! It is available for download and online reading HERE.

...

Web Cartoon Maker 1.5 is here!

Web Cartoon Maker 1.5 is finally here! You can download it HERE! Here is what was updated in version 1.5: Web Cartoon Maker Desktop Edition is now fully standal

...

read more news...


Poll