Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: gamerman on Sun 21/10/2007 22:58:50

Title: Problem with IsCollidingWithChar and PPC module
Post by: gamerman on Sun 21/10/2007 22:58:50
I'm working on my first game, that's like the firsts GTA games... My problem is: I want when the character CAR (who is a car :) ) collides with some other character (cEGO, for example), it's view is changed. I already tried the IsCollidinWithChar command and the PPC module, they don't worked.
Some help?



P.S - Sorry about my bad english :-\
Title: Re: Problem with IsCollidingWithChar and PPC module
Post by: Ashen on Sun 21/10/2007 23:20:17
What have you tried that didn't work? Post code.

Character.IsCollidingWithChar only checks the baselines of the Characters (i.e. if their feet are touching), so probably won't work if the car hits the other character head first. The PPC module, however, should work - depending on the way you've coded it, which is why you should always post code :)
Or how about AreThingsOverlapping (http://www.adventuregamestudio.co.uk/manual/AreThingsOverlapping.htm)? It's not limited to baseline checks, and seems like a common suggestion in other threads about IsCollidingWithChar.
Title: Re: Problem with IsCollidingWithChar and PPC module
Post by: gamerman on Sun 21/10/2007 23:31:01
Here's it:


if (PPColliding.CWithC(character[CARRO], character[EGO])) {
cEgo.ChangeView (4);
  }

and/or


if (cCarro.IsCollidingWithChar (cEGO) != 0) {
cEgo.ChangeView(4);
}

I tried to set the character baseline to another position, just to check, and it dont worked too...
Yes, i already tried AreThingsOverlapping, with the similars codes above and it dont worked.
Title: Re: Problem with IsCollidingWithChar and PPC module
Post by: Khris on Mon 22/10/2007 00:03:48
Where did you put that code? Inside what function?
Title: Re: Problem with IsCollidingWithChar and PPC module
Post by: gamerman on Sun 02/12/2007 17:31:55
I've put it in the function game_start an in the repeatedly_execute...



sorry about the long time to reply... :-\\
Title: Re: Problem with IsCollidingWithChar and PPC module
Post by: Scorpiorus on Fri 07/12/2007 16:53:04
When you say you've put it in repeatedly_execute, is it in the main global script or in a room script?

Try something like this:

in the main global script !

function repeatedly_execute( ) {

    if (AreThingsOverlapping( EGO, CARRO ))
    {
        Display( "They are overlapping! Press Alt-X to exit the game." );
    }

}


See if the message is displayed at all.
Title: Re: Problem with IsCollidingWithChar and PPC module
Post by: gamerman on Sat 15/12/2007 17:33:23
It worked, thanks!!!!;D