-
Notifications
You must be signed in to change notification settings - Fork 258
Add Champ outro animation prompt and script #1806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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: | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this is a CharacterBody2D, you could also do this by having invisible walls that it collides with, and handling (Not saying you have to change this, just an idea.) |
||||||||||||||
| champ_animation.scale.x *= -1 | ||||||||||||||
| velocity.x *= -1 | ||||||||||||||
|
Comment on lines
+17
to
+18
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another way you might spell this is:
Suggested change
I think the difference is that threadbare/scenes/game_elements/characters/player/components/player_sprite.gd Lines 13 to 14 in ecf740c
|
||||||||||||||
|
|
||||||||||||||
| # 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() | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://ctkcxtbfh6pwf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,31 @@ | ||
| [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"] | ||
| [ext_resource type="TileSet" uid="uid://bo4jyvl3lcww1" path="res://scenes/quests/story_quests/champ/champ_tileset.tres" id="3_o5ika"] | ||
| [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") | ||
| }, { | ||
|
Comment on lines
+15
to
+21
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "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" | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps?