Multiple Collisions

Game Editor comments and discussion.

Multiple Collisions

Postby BogdansB » Thu Sep 13, 2012 6:32 pm

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? :?:
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Multiple Collisions

Postby skydereign » Thu Sep 13, 2012 7:26 pm

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).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple Collisions

Postby BogdansB » Sat Sep 15, 2012 12:11 pm

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 ?
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Multiple Collisions

Postby skydereign » Sat Sep 15, 2012 6:55 pm

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
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest