Hi there, I need help with a checkpoint script for a test platformer I’ve been making with godot
i have dyscalculia, which is one of the reasons why it’s really hard for me to easily learn code, though I’m trying my best. I am more of an artist, not really a programmer though.
I got the script from a youtuber, but the problem is idk how to make it so that you can switch back to older checkpoints and undo the color changes of previous checkpoints. Also I can’t figure out how to make the color of the checkpoint actually change.
here is the script, how would I edit the script to undo changes to last checkpoint and update the changes for each time a checkpoint is touched?
extends StaticBody2D
class_name checkpoint
@export var spawnpoint = false
var activated = false
func activate():
global.current_checkpoint = self
activated = true
Color("Dark_Red")
func _on_area_entered(area):
if area.get_parent() is player_character:
activate()
so I updated my checkpoint script a bit, fixing most of the issues, but I was wondering how do you make the last checkpoint revert back to it’s default self_modulate value after hitting another checkpoint?
here is my script for my checkpoint
extends StaticBody2D
class_name checkpoint
@export var spawnpoint = false
var activated = false
func _ready():
if spawnpoint:
activate()
func activate():
global.current_checkpoint = self
activated = true
$Sprite2D.self_modulate = Color("DARK_RED")
func _on_area_entered(area):
if area.get_parent() is player_character:
activate()