2DCamera snaps to Map Side

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jffy

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.