Page 1 of 1

Multiple Collisions

PostPosted: Thu Sep 13, 2012 6:32 pm
by BogdansB
Hey ,

I was wondering if its possible to make the condition "if collides with 3 Actors of one type(name)" - then - blah blah ... (with 2 actors there is another effect)

is there a special code ? or how can i do it? :?:

Re: Multiple Collisions

PostPosted: Thu Sep 13, 2012 7:26 pm
by skydereign
You can using the getAllActorsInCollision function. It is relatively complex compared to other gE functions, but the example on this page for it is pretty good. http://game-editor.com/docs/script_reference.htm
Instead of using the loop like it does, all you need to do is use the value of n (since the function sets it equal to the number of actors it is colliding with).

Re: Multiple Collisions

PostPosted: Sat Sep 15, 2012 12:11 pm
by BogdansB
ok...

f.e. I have 2 types of smilys and i want an actor(0) to check if he colides with 2 smiling smilys:
:{ :] :{
:{ 0 :{
:] :{ :{


how can i do it ?

Re: Multiple Collisions

PostPosted: Sat Sep 15, 2012 6:55 pm
by skydereign
You use the Actor* to check if the actor is a smily actor or not. You can tell by comparing the name to "smily" using strcmp. If you look in the example in the script reference, you'll see how you can access an actor variable from the Actor* setup by getAllActorsInCollision. You still need to loop through it, but the only difference is that within the loop you check the names using strcmp. Here is how strcmp works.
Code: Select all
if(strcmp(string_variable, "check")==0) // this will only trigger if the string_variable is equal to check