Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Blackthorne on Tue 07/10/2003 22:03:42

Title: Collisions between Characters
Post by: Blackthorne on Tue 07/10/2003 22:03:42
Okay, I'm having a small problem - I need to make it so when one character touches another, the player dies.... I've used AreCharactersColliding, but it only works on a certain region.... do I have to set the whole screen as a region to which this pertains, or is there an easier way to do it?

Steve
Title: Re:Collisions between Characters
Post by: taryuu on Wed 08/10/2003 05:11:57
you mean the player chracater (ego) touches another chracter?  you could run the interations editor, and on (interact with) you could run a script that would kill one of them.  is that it or what?  
Title: Re:Collisions between Characters
Post by: Ishmael on Wed 08/10/2003 08:31:12
Are you using what? The global rep_ex? Room rep_ex? Or "player stands on region"?
Title: Re:Collisions between Characters
Post by: Minimi on Wed 08/10/2003 09:20:12
well, im at school at the moment so I can't type out of my head the code precise but maybee this is an idea.

Global Script repeatley execute :
set a line in there to set global value 1 to the x-coordinate of character1.

set a line in there to set global value 2 to the x-coordinate of character2.

set a line in there to set global value 3 to the y-coordinate of character1.

set a line in there to set global value 4 to the y-coordinate of character2.

after that... use set the following :
if "global value 1 " - "global value 2" = >10;
       // type here what happens when collision is there

after that... use set the following :
if "global value 3" - "global value 4" = >20;
       // type here what happens when collision is there

So this runs everytime a check if character 1, is from a certain distance from the other character... if it's within the numbers 10 and 20 then your code should be runned.

Maybee someone else can turn my idea into script... or I will look at it when I get home. GL!
Title: Re:Collisions between Characters
Post by: on Thu 09/10/2003 06:47:41
you could make a new function for it, which you then can use in the room rep_ex where you want to check if two characters are colliding...

But the AreCharactersColliding(); should work, if it is executed. Where do you have the command?