extends Node class_name PlayerRecorder var replay: ReplayRecording var this_frame: bool = true var sprite: int = 0 var player: Node var scene: Node export var save_to: String export var enabled: bool func _ready(): if not enabled: queue_free() replay = ReplayRecording.new() replay.time_per_frame = 1.0 / 30.0 player = get_parent() player.recorder = self scene = player.get_parent() func _physics_process(_delta): print(_delta) if this_frame: this_frame = false replay.positions.append(player.pos) replay.sprites.append(sprite) replay.frames += 1 else: this_frame = true func save(): replay.save_to_uri(save_to) queue_free()