Question about walk-behinds.

Started by Stupot, Tue 02/01/2007 20:06:50

Previous topic - Next topic

Stupot

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:



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

GarageGothic

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.

Khris

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:
Code: ags
  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.)

Stupot

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.

provost

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.

Khris

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.

provost

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.

SMF spam blocked by CleanTalk