Page 1 of 1

Collide Actor

PostPosted: Tue Aug 08, 2006 9:15 pm
by laddsa
Hi, if I have several actors moving around the screen randomly, and one stationery actor (called 'wall'), how can I find out which actor is colliding with the 'wall' actor?

Thanks in advance!

Laddsa

PostPosted: Tue Aug 08, 2006 9:33 pm
by Game A Gogo
are you using clones?

PostPosted: Tue Aug 08, 2006 9:38 pm
by laddsa
Hi Game a Gogo,

I haven't used any clone actors, just several individual actors (and the wall actor).

Thanks,

Laddsa

PostPosted: Tue Aug 08, 2006 9:53 pm
by Game A Gogo
well, in that case, you will have to do a collision check for every actor or using the "getactorincollision" something like that

PostPosted: Tue Aug 08, 2006 9:58 pm
by makslane
Use the 'collide' actor in the script to get the name of current collide actor.
In a collision event, you can get the name of collide actor with:

Code: Select all
collide.name

PostPosted: Tue Aug 08, 2006 10:03 pm
by Game A Gogo
makslane wrote:Use the 'collide' actor in the script to get the name of current collide actor.
In a collision event, you can get the name of collide actor with:

Code: Select all
collide.name

cool, that will come in handy!

what dos it dos when it collide whit multiple actor?

PostPosted: Tue Aug 08, 2006 10:17 pm
by laddsa
Thanks chaps, i'lll give that a go!

laddsa

PostPosted: Tue Aug 08, 2006 11:59 pm
by makslane
Game a Gogo wrote:what dos it dos when it collide whit multiple actor?


You receive one collision event for each actor.

PostPosted: Wed Aug 09, 2006 10:04 pm
by laddsa
That works fine and I am able to determine the actor that has collided with the wall. How do I use this information to move this actor? I have tried putting the 'collide.name' value into a string variable called 'col_actor' to identify the collide actor, and use it to move that actor, i.e.,

col_actor.x=col_actor.x-1;

But this doesn't seem to work. Is there another way I can achieve this?

Many thanks,

Laddsa

PostPosted: Wed Aug 09, 2006 10:40 pm
by makslane
Use the MoveTo action relative to the collide actor:

Code: Select all
MoveTo(collide.clonename, -1, 0, 10, collide.clonename);


Will move the collide actor to left 1 pixel.

PostPosted: Thu Aug 10, 2006 5:47 pm
by laddsa
That works great! Thanks Makslane!

Laddsa