0 votes

When you press certain buttons, the tilemap flips vertical or horizontally.
The problem is that the player could get stuck in the collision shape of a tile.
How i could transport my character to the top of the tiles when stuck in one?

in Engine by (122 points)
reshown by

What have you tried to solve issue already?

I used RayShape2d and it worked for my original question, but more important than the character being over a tile its that the player always has to be in the nearest free space, being the priorities up and down (depending on the position of the center of the collision shape, it will go to one direction or the other (if in the middle of the tile, then up) ) and left or right if there's no space in the previous directions.

Sounds complicated.. I would flip a tilemap around the player (if possible by game design)? So you'll sure there is allways going to be a space for a player.

Yeah, i know. If i don't find the way to do it relatively soon, then maybe that will be ok with an area2d? Thanks!

1 Answer

–1 vote

The easiest way would be to put your character node last in the tree, but you can also edit the Z index parameter of your character node (1 instead of 0 as default).

by (188 points)

if op wrote "on top" he means "on the ground", not "visible as topmost" .. in fact he's asking how to move sprite by 24 pixels.. ;)

Oh... then I can't answer :/

Exactly Reloecc, that's what i mean.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.