extends Node2D # Test the cutscene system func _ready() -> void: print("Testing cutscene system...") # Create test characters var char1 = Node2D.new() char1.name = "TestCharacter1" add_child(char1) var char2 = Node2D.new() char2.name = "TestCharacter2" add_child(char2) # Create animation player for char1 var anim_player = AnimationPlayer.new() anim_player.name = "AnimationPlayer" char1.add_child(anim_player) # Create a simple animation var animation = Animation.new() animation.name = "test_animation" animation.length = 1.0 anim_player.add_animation("test_animation", animation) # Test the cutscene system test_sequential_actions(char1, char2) # After a delay, test parallel actions var timer = Timer.new() timer.wait_time = 3.0 timer.one_shot = true timer.connect("timeout", test_parallel_actions.bind(char1, char2)) add_child(timer) timer.start() func test_sequential_actions(char1: Node2D, char2: Node2D) -> void: print("\n=== Testing Sequential Actions ===") # Create cutscene manager var manager = CutsceneManager.new() add_child(manager) # Connect signals manager.connect("cutscene_completed", _on_test_completed.bind("sequential")) # Add sequential actions manager.add_action(MoveAction.new(char1, Vector2(100, 100), 50.0)) manager.add_action(WaitAction.new(0.5)) manager.add_action(TurnAction.new(char1, Vector2(200, 200), 1.0)) manager.add_action(DialogueAction.new(char1, "Hello, world!", 1.0)) manager.add_action(AnimationAction.new(char1, "test_animation", false)) # Start the cutscene manager.start() func test_parallel_actions(char1: Node2D, char2: Node2D) -> void: print("\n=== Testing Parallel Actions ===") # Create cutscene manager var manager = CutsceneManager.new() add_child(manager) # Connect signals manager.connect("cutscene_completed", _on_test_completed.bind("parallel")) # Add parallel actions var parallel_group = [ MoveAction.new(char1, Vector2(300, 300), 100.0), MoveAction.new(char2, Vector2(400, 400), 100.0) ] manager.add_parallel_actions(parallel_group) # Add sequential actions after parallel manager.add_action(TurnAction.new(char1, char2, 2.0)) manager.add_action(DialogueAction.new(char1, "We moved together!", 1.5)) # Start the cutscene manager.start() func _on_test_completed(test_type: String) -> void: print("Test %s completed successfully!" % test_type) # Clean up after a delay var cleanup_timer = Timer.new() cleanup_timer.wait_time = 1.0 cleanup_timer.one_shot = true cleanup_timer.connect("timeout", clean_up) add_child(cleanup_timer) cleanup_timer.start() func clean_up() -> void: print("\n=== All tests completed ===") print("Cutscene system is working correctly!")