Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Stupot on Tue 02/01/2007 20:06:50

Title: Question about walk-behinds.
Post by: Stupot on Tue 02/01/2007 20:06:50
Hi guys, I'm new to this, but I promise I've tried to work this out for myself before I posted this message, but I'm not having much luck finding the answer.

I'm on the first screen of my game and I want to walk behind this fence:

(http://i50.photobucket.com/albums/f349/Captain_Stu/startscreen.jpg)

But no matter where I place the baseline, there are always moments when the character will either disappear from in front of the fence, or pop out from behind.

I think this is because of it's isometric perspective.Ã,  I was wondering if there was any way around this.Ã,  It would be good if you could tilt the baseline (there's an idea for the next version).

If all else fails I'l just have to make it so that the character can't walk directly behind the fence, just on the patch of grass that is visible... which brings me to my second question:

I can't figure out wether or not there is a way to Erase or backtrack parts of the "walkable area", so I looks like I'll have to delete the whole mask and redo it with my admendments... Is this the case or am I missing something obvious.

Thanks for reading, I promise I won't be one of these annoying people that constantly posts questions which should easily be found in the FAQ.

-Stu
Title: Re: Question about walk-behinds.
Post by: GarageGothic on Tue 02/01/2007 20:42:15
There ARE ways to do it (try searching the forum using the word "isometric"), but I don't really think it's worth it - there is no good reason for the character to stand right there anyway. And sure, there is a way to erase walkable areas. Just paint it with walkable area color 0.
Title: Re: Question about walk-behinds.
Post by: Khris on Tue 02/01/2007 21:06:34
To partly erase walkable areas, draw over them with an unused color, then erase the new area.

To solve the walkbehind problem:
Draw a region containing the part of the walkable area behind the fence.

Then add this to the room's repeatedly execute:
  if (Region.GetAtRoomXY(player.x, player.y)==REGION_NUMBER)
    SetWalkbehindBase(WALKBEHIND_NUMBER, 240);
  else
    SetWalkbehindBase(WALKBEHIND_NUMBER, 0);


(Of course this code won't work as is, you've got to fill in the numbers of the walkbehind and region.)
Title: Re: Question about walk-behinds.
Post by: Stupot on Tue 02/01/2007 21:24:18
Ahh thanks guys.  I think I will just delete the walkable area behind the fence, as you say GG, it's not really worth going behind there.

Thanks for that bit of code Khris, but at this early stage I'm just trying to learn my way around the interface before plunging into the script.

Thanks again.
Title: Re: Question about walk-behinds.
Post by: provost on Fri 05/01/2007 18:17:45
I have solved similar problems like this using regions as well but slightly differently.

How I would do it is to make a region that contains the entire walkable area that is behind the fence, when the player walks onto the region, then change the walkbehind baseline to be at the bottom of the screen.  When the player walks off the region, change the baseline to the top.

it prevents unnecessary code in a repeatedly execute loop, but it does have the problem that if other characters are outside the fence at the same time, they will be adversely affected by walking up to the fence.
Title: Re: Question about walk-behinds.
Post by: Khris on Fri 05/01/2007 19:21:42
Usually a room's repeatedly execute isn't used much, except for things exactly like what this thread is about. So I wouldn't consider my code unnecessary, more since it does the exact same thing you described.

If there's going to be more than one moving character in the room, the only possible solution I can think of right now is to break down the walkbehind into several parts and make sure the walkable areas are far enough from the fence to prevent display errors.
Title: Re: Question about walk-behinds.
Post by: provost on Fri 05/01/2007 20:51:51
I agree with that.. also, please dont misunderstand - i dont think your CODE is unnecessary, I just try to keep my repeatedly executes to as little as possible; thats just the way I do my rooms.  I wont claim that its superior in any way, i was just trying to offer a similar alternative :)

Breaking the walk behinds down in the room is really the only alternative that I know of if there are others in the room though, I agree.