A quick question

Non-platform specific questions.

A quick question

Postby GLZ » Sat Jul 02, 2011 10:17 pm

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.
GLZ
 
Posts: 2
Joined: Sun May 22, 2011 4:44 pm
Score: 0 Give a positive score

Re: A quick question

Postby Insomniac » Sat Jul 02, 2011 11:37 pm

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)
Insomniac
 
Posts: 3
Joined: Sat Jul 02, 2011 5:45 am
Score: 0 Give a positive score

Re: A quick question

Postby GLZ » Sun Jul 03, 2011 12:58 am

the problem is that it would take forever. is there any faster way?
GLZ
 
Posts: 2
Joined: Sun May 22, 2011 4:44 pm
Score: 0 Give a positive score

Re: A quick question

Postby jimmynewguy » Sun Jul 03, 2011 3:43 am

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
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: A quick question

Postby Troodon » Tue Jul 05, 2011 8:41 pm

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? :)
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: A quick question

Postby lcl » Tue Jul 05, 2011 10:55 pm

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
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest