Godot Version
4.2.2
Question
I am very new to the engine, so correct me if I do something wrong. I recently followed Brackey’s tutorial on Youtube, and I am now making my own platformer. I wanted to add checkpoints, so instead of resetting the scene, I made the player move to the checkpoint’s location. However, this causes the player to glitch in an infinite loop where it falls down slowly. I use an autoload scene called Global.tscn to manage the variable “reset”.
This is the code I added to the player movement (using the default CharacterBody2D movement script):
reset player
if Global.reset == true:
reset_player()
func reset_player():
position = Vector2(0, 0)