Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: magintz on Thu 04/03/2004 11:12:04

Title: If player is on a walkable area
Post by: magintz on Thu 04/03/2004 11:12:04
Hi there, long time no post in here, but i'm having some problems, I need to run an IF statement asking if the player character is on walkable area 1 or 2 and depending on what walkable area the character is on depends on which object shows up, 1 or 0.

Object One should appear if the character is on area 1
Object Zero should appear if the character is on area 2

any help here?
Title: Re:If player is on a walkable area
Post by: on Thu 04/03/2004 11:27:08
If I remember right, there is a function like GetWalkableAreaAt... but I'm not sure. Anyhow, to get the player's position, use
character[GetPlayerCharacter()].x
character[GetPlayerCharacter()].y
global vars.
Title: Re:If player is on a walkable area
Post by: magintz on Thu 04/03/2004 12:01:21
yes but doesnt that just find out the x and y co-ordinates? I need the whole of the walkable area
Title: Re:If player is on a walkable area
Post by: Timosity on Thu 04/03/2004 12:19:29
could you use regions instead, you can copy the walkable areas straight into regions in the editor (there's a button you click on [note: if you already have regions on this screen it will wipe them]).

then choose player walks onto region, and set the objects in the script there.
Title: Re:If player is on a walkable area
Post by: magintz on Thu 04/03/2004 19:43:18
nm i sorted it, it was simple when i thought about it i just had to get the character location and match it with a walkable area, but I don't need it any more i just have to wait for some character art/animation before I can continue
Title: Re:If player is on a walkable area
Post by: Kweepa on Thu 04/03/2004 19:45:35
in repeatedlyexecute:

int walkArea = GetWalkableAreaAt(character[EGO].x, character[EGO].y);

ObjectOff(0);
ObjectOn(1);
if (walkArea == 1) ObjectOn(1);
else
if (walkArea == 2) ObjectOn(0);

[EDIT] Didn't see that last post...