Page 1 of 1

How to access assets from two colliding actors?

PostPosted: Sat Aug 26, 2006 4:31 pm
by waggle
I have a situation were I have two colliding bodies and I need to create another based upon that collision.

Creating a new actor is simple using something like the below code:


CreateActor("MyActor", "MyActor", "view", "(none)", x, y, false);

The difficultly I am encountering is that I need to be able to access some of the variables in the newly made actor based upon the data from the two colliding actors.

In other words, in the collision event handling script I need to:

1. Create a new actor.
2. modify some of it’s actor variable contents based upon values from the two colliding actor’s variables.


How do I reference these variables?

Hopefully I’ve made myself clear.

PostPosted: Sat Aug 26, 2006 5:52 pm
by makslane
You can get the returned pointer to access the new actor:

Code: Select all
Actor *newActor = CreateActor("MyActor", "MyActor", "view", "(none)", x, y, false);

newActor->lives = 3; //For example
 


If you are in a Collision event, just use the actor 'collide' the access the variables on collide actor:

Code: Select all
newActor->lives = collide.lives; //For example

PostPosted: Sat Aug 26, 2006 8:06 pm
by waggle
Excellent. Thanks for the assistance.