Help with checkpoints in platformer game

Godot Version



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:
func reset_player():
	position = Vector2(0, 0)

Not sure how the rest of your code looks, but perhaps adding a simple Global.reset = false to the reset_player() function would at least break the infinite loop.

thanks :slight_smile: :laughing: Small mistake there