0 votes

I am working on a top-down game where the user controls the screen and not an individual player (RTS). I have created the map using a Node2D and a TileSet. I am now working on the camera using a Camera2D and have implemented movement using WASD and Mouse-wheel to zoom in and out.

While testing the camera movement, I noticed that my ability to move the camera stops at the edges of the map (purposeful by setting the correct limits). However, I cannot move the camera left/right or up/down (depending) until I use the correct number of key presses. For example, I move over the left edge of the map and hit the 'A' key 5 times, I cannot scroll right with the 'D' key until I hit the D key 5 times. I can still move up or down and scroll out/in during this.

I have tried implementing clamps on the limits corresponding the position.x/y as well as tried searching for the position.x/y and testing to see if it exceeds the limit_right/left/up/bottom. Both have failed thus far and I am left scratching my head as to why I can't easily scroll on the sides of the map. Any ideas or help on this would be greatly appreciated.

Note: The Node2D implements the limits for the camera.

asked Apr 15 in Engine by jffy (12 points)

Please log in or register to answer this question.

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 How to use this Q&A? before posting your first questions.