0 votes

I have a camera2d set up to update it's global position when player enters a new area. It does this through updating a singleton variable "camera_position" when it enters that new area. When the player dies, I reload the scene. However, there is a quick jerk from the original position (when reloaded) to the new position. Anyone know how to fix this? Camera's are particularly hard for me to learn :(

Here is code snippet:


func _ready():
global_position = GameState.camera_position  

(Singleton) GameState:

var camera_position = Vector2.ZERO
var player_position = Vector2(34,121)


func body_entered(body):
if body.name == "Player":

    GameState.camera_position = global_position

    GameState.player_position = body.global_position
asked May 7 in Engine by alexgomez141 (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.