Page 1 of 1

on collision -> any actor BUT not event actor?? possible?

PostPosted: Sat Jun 30, 2007 5:41 pm
by sonicfire
Hi there!

I hope the topic title isn´t confusing, what i want to have/achieve is:

I have a bullet, whenever it hits anything it should just destroy itself. That works fine using collision with "Any Actor". My problem: Of course now, when this bullet hits itself (when two bullets collide) they destroy each other!

Is there a way to avoid this? Something like "On Collision with Any actor but not with itself" :oops: ?

PostPosted: Sat Jun 30, 2007 7:19 pm
by d-soldier
I have never been able to use the "anyactor" because the background (sky) is an actor too... So I would suggest spelling it out, add a collision event for each object you want it to collide with.

PostPosted: Sat Jun 30, 2007 8:46 pm
by sonicfire
thanks, d-soldier! :)
yes, i guess that´s still the best way to do it - i was just curious!

PostPosted: Sat Jun 30, 2007 10:28 pm
by Fuzzy
d-soldier wrote:I have never been able to use the "anyactor" because the background (sky) is an actor too...


Do you ever want to collide with the sky? if not.. in sky's create actor event, do the collision state action and set it to FALSE.

PostPosted: Sat Jun 30, 2007 10:44 pm
by d-soldier
Didn't think of doing that before.... nice way to think outside the box.

PostPosted: Sat Jun 30, 2007 11:01 pm
by Kodo
Fuzzy wrote:
d-soldier wrote:I have never been able to use the "anyactor" because the background (sky) is an actor too...


Do you ever want to collide with the sky? if not.. in sky's create actor event, do the collision state action and set it to FALSE.


I tend to do this on any objects that will never need to receive collisions, including interface objects and backgrounds. I'm not certain but it must help keep the frame rate up in a complex game if it's not having to check so many actors for collision. Especially when I work mainly on Pocket PC and GP2X where you don’t have the raw power found in the desktop systems to throw at a game, I figure every little saving helps :)

PostPosted: Sat Jun 30, 2007 11:12 pm
by Fuzzy
Kodo, You would have to ask Makslane to confirm that, but I suspect you are right. GE would compile several lists of actors(collide, no collide, out of view, not created,....) and check collisions(and other things like draw) against only some of those.

PostPosted: Mon Jul 02, 2007 4:27 pm
by Sgt. Sparky
I made a Demo on how to do this a different way so certain actors can still have collision events:
...Argh I can't find it.....
just make a variable called value and make it an actor variable,
and on the create actor events of the actors you want your player to collide with use,

Code: Select all
value = 1;


and on collision on any actor,

Code: Select all
if(value == 1)
{
    //...code here...
}

:D