Referencing velocities of other objects

Game Editor comments and discussion.

Referencing velocities of other objects

Postby beefwelington » Wed Jul 26, 2006 11:34 pm

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?
beefwelington
 
Posts: 13
Joined: Wed Jul 19, 2006 9:47 pm
Score: 0 Give a positive score

Postby makslane » Thu Jul 27, 2006 2:17 am

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;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest