diff --git a/scenes/quests/story_quests/champ/4_outro/champ_animation.gd b/scenes/quests/story_quests/champ/4_outro/champ_animation.gd new file mode 100644 index 0000000000..7581b554fc --- /dev/null +++ b/scenes/quests/story_quests/champ/4_outro/champ_animation.gd @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: The Threadbare Authors +# SPDX-License-Identifier: MPL-2.0 +extends CharacterBody2D + +@onready var champ_animation: AnimatedSprite2D = $AnimatedSprite2D + +var swim_speed: int = 100 + +func _ready() -> void: + # Give champ a starting swim speed + velocity.x = swim_speed + +func _physics_process(_delta: float) -> void: + # Make sure Champ doesn't swim out of the water! + # If he gets too close, turn him around and start swimming the other direction + if position.x > 400 or position.x < 0: + champ_animation.scale.x *= -1 + velocity.x *= -1 + + # TODO: Can we make Champ swim in a more interesting pattern? + # Can we change the way Champ swims vertically? Can we accelerate? + + # Continues to move the CharacterBody2D Object based on it's velocity + move_and_slide() diff --git a/scenes/quests/story_quests/champ/4_outro/champ_animation.gd.uid b/scenes/quests/story_quests/champ/4_outro/champ_animation.gd.uid new file mode 100644 index 0000000000..f0979aea47 --- /dev/null +++ b/scenes/quests/story_quests/champ/4_outro/champ_animation.gd.uid @@ -0,0 +1 @@ +uid://ctkcxtbfh6pwf diff --git a/scenes/quests/story_quests/champ/4_outro/champ_outro.tscn b/scenes/quests/story_quests/champ/4_outro/champ_outro.tscn index 976b87e4fa..999bb7644d 100644 --- a/scenes/quests/story_quests/champ/4_outro/champ_outro.tscn +++ b/scenes/quests/story_quests/champ/4_outro/champ_outro.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=4 uid="uid://bbjh0yoqbchuo"] +[gd_scene load_steps=10 format=4 uid="uid://bbjh0yoqbchuo"] [ext_resource type="PackedScene" uid="uid://cfcgrfvtn04yp" path="res://scenes/ui_elements/hud/hud.tscn" id="1_x48x5"] [ext_resource type="SpriteFrames" uid="uid://ctjbkxw0r2f2i" path="res://scenes/quests/story_quests/champ/player_components/champ_player.tres" id="3_276wt"] @@ -6,6 +6,26 @@ [ext_resource type="Script" uid="uid://x1mxt6bmei2o" path="res://scenes/ui_elements/cinematic/cinematic.gd" id="4_jdkp3"] [ext_resource type="Resource" uid="uid://cwp3r5nyfb0bf" path="res://scenes/quests/story_quests/champ/4_outro/outro_components/champ_outro.dialogue" id="5_f2mqr"] [ext_resource type="Texture2D" uid="uid://b1knp31rwuxpq" path="res://scenes/quests/story_quests/champ/tiles/assets/blank_champ.png" id="7_276wt"] +[ext_resource type="Script" uid="uid://ctkcxtbfh6pwf" path="res://scenes/quests/story_quests/champ/4_outro/champ_animation.gd" id="7_jdkp3"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_f2mqr"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_6d3de"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("7_276wt") +}, { +"duration": 1.0, +"texture": ExtResource("7_276wt") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] [node name="Outro" type="Node2D"] @@ -44,7 +64,20 @@ dialogue = ExtResource("5_f2mqr") next_scene = "uid://cufkthb25mpxy" metadata/_custom_type_script = "uid://x1mxt6bmei2o" -[node name="BlankChamp" type="Sprite2D" parent="."] -position = Vector2(746.75006, 173.74997) -scale = Vector2(2.003906, 2.003906) -texture = ExtResource("7_276wt") +[node name="CharacterBody2D" type="CharacterBody2D" parent="."] +script = ExtResource("7_jdkp3") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] +shape = SubResource("CircleShape2D_f2mqr") + +[node name="Label" type="Label" parent="CharacterBody2D"] +offset_left = 305.0 +offset_top = 161.0 +offset_right = 409.0 +offset_bottom = 184.0 +text = "Animate me!" + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D"] +position = Vector2(372, 151) +sprite_frames = SubResource("SpriteFrames_6d3de") +autoplay = "default"