Difference between walkable area limit and actual position of the character

Started by Manu, Sun 10/01/2021 15:26:02

Previous topic - Next topic

Manu

Hello
I hope my question is not too dummy even for the beginners' forum. I have a walkable area that does not go above Y=100. However, my character is able to go above this line: the feet stop approx 10 pixels above this. The sprite of the character does not have empty lines at the bottom.
Is this normal? How is exactly detected when the character is outside the walkable area?

Thanks a lot!


Matti

You can see the walkeable area in-game by pressing Ctrl + A (if debug mode is on). This might be helpful.

Have you perhaps changed the z-coordinate of the character?

Manu

Yes if I use Ctrl+A, I can see the character is clearly outside the walkable area. I have no idea how to change the Z-coordinate. How do I check that Z is ok?

arj0n


Manu

Not intentionally, anyway, if I search for "Baseline" in the script, or cEgo.Baseline, I don't find anything. Same thing for player.z

It's really weird. I tried to erase the walkable area and redesign it, and it's the same. When I click (with "shoes" icon selected) on a point above and outside the walkable area, the character starts walking up and does not stop. He stops several pixels above that. Do hotspots or regions outside walkable areas can affect where the character can move?

Khris

Can you add this to the room script of the room in question?

Code: ags
function on_key_press(eKeyCode k) {
  if (k == eKeySpace) {
    ClaimEvent();
    Display("Player in WA #%d", GetWalkableAreaAtRoom(player.x, player.y));
  }
}

Now run your game, let the character walk off the walkable area and press space. What does it say?

Crimson Wizard

To double check: you are not calling Walk with eAnywhere parameter?
Does the result depend on where do you click (further or closer to the area)? Does it depend on area shape and location etc, is it happening in one room or in all of them?


Quote from: arj0n on Sun 10/01/2021 21:18:16
Have you changed the character's baseline somewhere?

Baselines should not have any effect on that, they define only the order of drawing objects on screen.

Manu

Thanks a lot, Khris for the code!
With it, I realized that character is inside walkable area #1. Checking the coordinates very carefully, the area top right corner was 102,136, and the character was exactly at 102,136. So my bad, it looked like it was outside, but it's inside. I need better eyes.
Sorry about it.

Cassiebsg

Do you have alpha/transparent pixels under your characters feet? and how does he look exactly, is he drawn from a strait front/side view, or is he slightly diagonal towards the camera?

Remember that AGS has no idea where the feet of your character are. It will calculate the "feet" exactly at the lower-middle point of your sprite. use player.z=-10 if that's the amount of pixels in relation to the sprite the feet are actually at. Also always cut a few pixel of the edge of the walkable area, so you can be 100% he'll never be walking "on the wall".  ;)
There are those who believe that life here began out there...

Manu

No, there are no transparent pixels under the feet. The problem is I thought AGS was doing a kind of "collision detection" with the walkable area, while instead, as you just said, it's a matter of checking if the point in the lower-middle is inside the walkable area. I just realized that :)
Thanks!

SMF spam blocked by CleanTalk