Page 1 of 1

Referencing velocities of other objects

PostPosted: Wed Jul 26, 2006 11:34 pm
by beefwelington
Say I want to spawn an actor and give it the same velocity as an already existing actor. Is there a simple way to reference the velocity (and position) of another actor? Like actor1.yvelocity or something?

PostPosted: Thu Jul 27, 2006 2:17 am
by makslane
If you want give the same velocity of the creator, you can use the pointer returned by the CreateActor funcion:

Code: Select all
Actor *act = CreateActor("bullet", "icon", "no parent", "no path", 0, 0, false);
act->xvelocity = xvelocity; //velocity of new actor will be the same of the creator


Or, in the 'Create Actor' event of the bullet get the velocity in the creator variable:

Code: Select all
xvelocity = creator.xvelocity;