Bug: Camera moves oddly when entering/exiting interiors
Closed this issue · 1 comments
Describe the bug
Entering or exiting an interior area creates an unexpected 1 second period of camera movement instead of instantly viewing the intended position
To Reproduce
Steps to reproduce the behavior:
- Launch game with
python -m rpg
- Immediately walk up into the first door above the player using
W
or the up arrow key - Watch the camera move for roughly 1 second before settling on a reasonable view
- Walk down to exit the building using
S
or the down arrow key - Watch the camera move for roughly 1 second before settling on a reasonable view
This also applies to:
- the door to the west of the first door from spawn, on the same building
- the hole in the graveyard at the west side of the map
Expected behavior
The camera instantly jumps to an appropriate position
This is roughly related to the camera being scrolled multiple times. There is a switch_map
function which handles the map switching upon contact with a door that leads to a new map. This function scrolls the camera with an instant move speed(1.0).
However the on_update
function also constantly scrolls the camera using the default camera move speed(which is not instant to create the scrolling camera effect), this means that we're essentially instantly scrolling the camera to the player, and then trying lerp it there on the normal camera speed at the same time, so it creates this rubber band effect we see now.
What we will need for this is a way to control the camera scroll speed for a given run on of on_update
, such that it could be the normal camera speed constant normally, but could be changed to 1.0 if we are changing maps.