Walkable area baseline

Started by nightmarer, Sun 19/07/2020 18:11:43

Previous topic - Next topic

nightmarer

Hello.

How can I make it to do a walkable area place wih a especific baseline?
I tried to find one function to know the walkable id where a character is, but I just found GetWalkableAreaAt but it does a different thing.

Regards.

Crimson Wizard

#1
Walkable areas do not have baselines because they are not drawn on screen. Can you explain what are you trying to do?



Quote from: nightmarer on Sun 19/07/2020 18:11:43
I tried to find one function to know the walkable id where a character is, but I just found GetWalkableAreaAt but it does a different thing.

GetWalkableAreaAt() accepts screen coordinates, so to find out where character is you need to convert character's coordinates to screen coordinates like this:
Code: ags

GetWalkableAreaAt(cChar.x + GetViewportX(), cChar.y + GetViewportY());


But if you are using AGS 3.5.0, there's already an easier GetWalkableAreaAtRoom function:
Code: ags

GetWalkableAreaAtRoom(cChar.x, cChar.y);

nightmarer

Hello.
My character walks in a room which is a library. If the character is at the bottom of the screen it should stay in front, but if he enters in a corridor then the shelves should cover him, so need to change the baseline when he enters in that corridor.

Crimson Wizard

Quote from: nightmarer on Tue 21/07/2020 11:36:37
My character walks in a room which is a library. If the character is at the bottom of the screen it should stay in front, but if he enters in a corridor then the shelves should cover him, so need to change the baseline when he enters in that corridor.

In this case you need to set shelves' baselines. By default character's baseline changes automatically according to its Y position. If you set shelves' baseline to 100, then character at Y > 100 will be drawn before shelves, and character with Y < 100 will be drawn behind shelves.

Either make shelves a separate room object, or paint walk-behind area there. Objects and walk-behinds both have baselines, and you may set them in room editor.

Snarky

As Crimson Wizard indicates, this is not about the walkable area, but about a "walk-behind" area. These are two entirely different things in AGS. Basically, the walkable areas are the parts of the screen characters can stand or walk on, while the walkbehinds are parts of the screen that will hide them if they are behind some baseline. Walkable areas are typically the floor, while walkbehinds are typically things like walls, fences, trees, tables… and shelves.

Quote from: nightmarer on Tue 21/07/2020 11:36:37
If the character is at the bottom of the screen it should stay in front, but if he enters in a corridor then the shelves should cover him, so need to change the baseline when he enters in that corridor.

"If the character is at the bottom of the screen it should stay in front, but if he enters in a corridor then the shelves should cover him."

The description is not 100% clear, but it doesn't sound as if you should need to change the baseline dynamically. Just set the baseline of the shelves at the point where the shelves meet the ground (if the shelves are an object, this happens automatically). When the character is at the bottom of the screen, he's below that baseline, so he appears in front. When he enters the corridor he is (I assume) above the baseline, so he appears behind.

SMF spam blocked by CleanTalk