I’m now making a platformer game and wanted to implement a checkpoint system that involves getting the name of a signal emitter which is an Area2D. Here is an outline of what I want to do
var Player = self.get_parent().get_node("Player")
func Checkpoint_Touched(body):
if body == Player:
$Signal_Emitter.position = Player.SpawnPosition
Signal_Emmiter is replaced with the name and SpawnPosition is a custom property
I would prefer not to create numerous scripts for each checkpoint, as this would result in an excessive number of script files in my project. Such an accumulation would lead to a mess, with each file containing similar code, which I aim to avoid.
Assuming the signal has the same name on each checkpoint, the script wouldn’t need to be different for each instance. You just attach the same script to each one.