extends SceneTree ## Dev helper: run the game windowed for N frames, save a screenshot, quit. ## Usage: godot --path . -s res://src/test/take_screenshot.gd (windowed) var frames := 0 const TARGET_FRAMES := 300 func _initialize() -> void: # Launch the main scene. var packed: PackedScene = load("res://scenes/main.tscn") var inst: Node = packed.instantiate() root.add_child(inst) func _process(_delta: float) -> bool: frames += 1 if frames == 60: var img: Image = root.get_texture().get_image() var err := img.save_png("user://screenshot.png") print("screenshot saved err=", err) quit(0) return true if frames > TARGET_FRAMES: quit(0) return true return false