Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: limeTree on Fri 14/07/2006 12:59:56

Title: Run interaction when characters collide
Post by: limeTree on Fri 14/07/2006 12:59:56
Its like this.
I make a main character that goes to a basement,finds a strange machine with a hole,throws a bottle and suddenly attacked by vampire.
I managed to make him follow her but how to make him kill her when reaching her.
I tried things like:(IScollidingwithchar-but i dont understand the area code,i write something like quti game and it doesnt work)
Can somebody please explain me how to make that vampire follow the character and kill him if he touches him.(Like 5 days a stranger,or Clock tower.)

EDIT by Ashen: descriptive title.
Title: Re: How to make enemys(Like 5 days a strenager)(Clocl Tower,hehe)
Post by: R4L on Fri 14/07/2006 13:19:03
Try one of the modules around here. I believe there is a module that suits your needs in the Technical Archive.

EDIT: Here is a link to SSH's Pixel Perfect Collision Detection Module.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26307.0
Title: Re: How to make enemys(Like 5 days a strenager)(Clocl Tower,hehe)
Post by: Khris on Fri 14/07/2006 14:37:49
Put this in the repeatedly_execute():

if (player.IsCollidingWithChar(character[VAMPIRE])) {Ã,  Ã, //Ã,  or cVampire, whatever his name is
  Display ("You're dead.");
Ã,  QuitGame(0);
}

What do you mean when talking about "area code"?
Title: Re: How to make enemys(Like 5 days a strenager)(Clocl Tower,hehe)
Post by: Ashen on Fri 14/07/2006 14:48:49
Can you post exactly the code you tried, and where you put it?
Khris's code should work, although Character.IsCollidingWithChar only checks the baselines of the characters - AreThingsOverlapping (http://www.adventuregamestudio.co.uk/manual/AreThingsOverlapping.htm), or the module Rap4Life42o mentioned, might give better results.
You could also directly compare the characters coordinates (again, in repeatedly_execute) - but posssibly that's what you meant by not understanding the 'area code'? There's a couple of examples you could work from in the RPG thread (starting here (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=13649.msg301617#msg301617) - just ignore the keycode stuff).

And please use a more descriptive thread title in the future.