2d player not moving past a certain point on map?

Godot 4.5

Hi! I’m new to godot, so I ended up using a tutorial for player movement. (the one on the official site!)

however, i run into an issue where whenever the player tries to move past a certain point, they can’t? it’s like an invisible boundary box. there’s a thin blue rectangle that seems to be the limits, but i can’t for the life of me figure out what it’s called or how to change it.

pictures are of the furthest down/left i can go (it’s unrelated to the tiles on the tilemap themselves, i’ve tried different configurations), and the blue rectangle in the editor. (ignore the messy layout, this is a scene for testing things) i’m not new to game dev, but code is often my enemy, so this could be a me thing.

The blue line is typically your the size of your viewport under: Project Settings > Display > Window > Viewport Width/Height

Have you configured you code to take into account your viewport in some way.

It is really tough to say whats wrong without seeing your player movement code.

1 Like

thank you! the code is the basic player movement code from the 2d movement tutorial on the godot website, because i’m new to GDscript and not confident in writing my own code. i’m not entirely sure what the viewport/screen size does here, and i couldn’t find any answers, so i didn’t want to fiddle with it without understanding.

Update: Changed the width/height and that changed the movement difference, so you were correct! i just need to figure out how to make it not take that into account, i guess?


viewport is typically the size of the window that player will get to see

when you click play and look on the top right:


you can see what the viewport size is

in your game it seems that the camera is smaller than the viewport (the purple line around the player compared to the blue line)

2 Likes

thank you so much!! got rid of that and no more issues. i know it’s a pretty silly issue but it means a lot that you helped! c(^-^)d