Page 1 of 1

A quick question

PostPosted: Sat Jul 02, 2011 10:17 pm
by GLZ
is there a way to have something like: Collision - any side - any actor *except* (insert actor name) ?

I have a player who shoots a laser and I want it to destroy itself and make sparks when it hits anything, but it keeps hitting the player instead. I want it to work on every actor except the player.

Re: A quick question

PostPosted: Sat Jul 02, 2011 11:37 pm
by Insomniac
The easy way would be to add collison on everything you want the laser to hit except the player (just dont add laser collision to the player) & to make the laser destroy itself and spark on collison, if you dont want to use script just add a new collision event to the laser...

Make a new collsion event, on any side, choose collision actor, repeat event NO, Add Action, Change Animation, choose laser actor, spark animation, Forward (make sure you add the spark animation to the laser actor first)

Re: A quick question

PostPosted: Sun Jul 03, 2011 12:58 am
by GLZ
the problem is that it would take forever. is there any faster way?

Re: A quick question

PostPosted: Sun Jul 03, 2011 3:43 am
by jimmynewguy
Make a variable called like laser_col or something and set it to equal 1 for the player. Then do the collision and if(laser_col == 0){do the collision} would be the fastest way

Re: A quick question

PostPosted: Tue Jul 05, 2011 8:41 pm
by Troodon
But then if the player shoots a mirror and the lazer gets back to him, nothing would happen. I suggest you use "torpedo method". Make a variable called for example Activated. The lazer is launched passive but when it gets far enough from the player (you can use timer or whatever suits your needs the best), it goes to 1. And then have the collision with any actor event to happen only when the lazer is "activated". But Jimmynewguys method would be better if you have let's say, background image. You don't want it to blow up, don't you? :)

Re: A quick question

PostPosted: Tue Jul 05, 2011 10:55 pm
by lcl
I'd like to say this being the easiest way:
Laser - collision - any side of - any actor - script editor:
Code: Select all
if (strcmp(collide.name, "player") != 0){DestroyActor("Collide Actor");}

Now, if the actor that laser hits is named player, it won't be destroyed, but actor with any other name would be. :D