-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate pawn animation from the PawnActor into a PawnAnim scene
Just like BattlerAnim before it, we have pawns that are reusable character controllers, that apply to NPCs and to the playable character. And these pawns could be any character in the game, so we need to be able to change the skin on them. Having separate scenes for animation is also essential for animators to be able to do their job properly, while the devs can keep working on the Pawn scenes
- Loading branch information
1 parent
3d8f3b5
commit 9e0bb7b
Showing
7 changed files
with
106 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
extends Position2D | ||
|
||
class_name PawnAnim | ||
|
||
onready var anim = $AnimationPlayer | ||
|
||
func play_walk(): | ||
anim.play("walk") | ||
yield(anim, "animation_finished") | ||
|
||
func play_bump(): | ||
anim.play("bump") | ||
yield(anim, "animation_finished") | ||
|
||
func get_current_animation_length(): | ||
return anim.current_animation_length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[gd_scene load_steps=5 format=2] | ||
|
||
[ext_resource path="res://animation/PawnAnim.gd" type="Script" id=1] | ||
[ext_resource path="res://assets/sprites/local_map/characters/robi_pawn.png" type="Texture" id=2] | ||
|
||
[sub_resource type="Animation" id=1] | ||
|
||
resource_name = "bump" | ||
length = 0.1 | ||
step = 0.01 | ||
tracks/0/type = "value" | ||
tracks/0/path = NodePath("Root:position") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/keys = { | ||
"times": PoolRealArray( 0, 0.02, 0.04, 0.06, 0.08, 0.1 ), | ||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ), | ||
"update": 0, | ||
"values": [ Vector2( 0, 0 ), Vector2( -1.5, -9 ), Vector2( 6.5, 2.5 ), Vector2( -11.5, 8.5 ), Vector2( 4, -5 ), Vector2( 0, 0 ) ] | ||
} | ||
|
||
[sub_resource type="Animation" id=2] | ||
|
||
resource_name = "walk" | ||
length = 0.25 | ||
step = 0.05 | ||
tracks/0/type = "value" | ||
tracks/0/path = NodePath("Root:position") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/keys = { | ||
"times": PoolRealArray( 0, 0.1, 0.15, 0.25 ), | ||
"transitions": PoolRealArray( 1, 0.303143, 2.61003, 1 ), | ||
"update": 0, | ||
"values": [ Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 1.43051e-06, -1.90735e-06 ), Vector2( 0, -20 ), Vector2( 1.43051e-06, -1.90735e-06 ) ] | ||
} | ||
tracks/1/type = "value" | ||
tracks/1/path = NodePath("Root:scale") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/keys = { | ||
"times": PoolRealArray( 0, 0.05, 0.15, 0.25 ), | ||
"transitions": PoolRealArray( 1, 0.354553, 1, 1 ), | ||
"update": 0, | ||
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ] | ||
} | ||
|
||
[node name="PawnAnim" type="Position2D"] | ||
scale = Vector2( 0.328641, 0.328641 ) | ||
script = ExtResource( 1 ) | ||
|
||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] | ||
anims/bump = SubResource( 1 ) | ||
anims/walk = SubResource( 2 ) | ||
|
||
[node name="Root" type="Position2D" parent="."] | ||
position = Vector2( 1.43051e-06, -1.90735e-06 ) | ||
|
||
[node name="Body" type="Sprite" parent="Root"] | ||
position = Vector2( 0, -170.399 ) | ||
texture = ExtResource( 2 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,22 @@ | ||
[gd_scene load_steps=6 format=2] | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://local_map/pawns/PawnFollower.gd" type="Script" id=1] | ||
[ext_resource path="res://local_map/pawns/sprites/character.png" type="Texture" id=2] | ||
[ext_resource path="res://animation/PawnAnim.tscn" type="PackedScene" id=2] | ||
|
||
[sub_resource type="Animation" id=1] | ||
[sub_resource type="RectangleShape2D" id=1] | ||
|
||
resource_name = "bump" | ||
length = 0.1 | ||
loop = false | ||
step = 0.01 | ||
tracks/0/type = "value" | ||
tracks/0/path = NodePath("Pivot/Sprite:position") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/keys = { | ||
"times": PoolRealArray( 0, 0.02, 0.04, 0.06, 0.08, 0.1 ), | ||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ), | ||
"update": 0, | ||
"values": [ Vector2( 0, 0 ), Vector2( -1.5, -9 ), Vector2( 6.5, 2.5 ), Vector2( -11.5, 8.5 ), Vector2( 4, -5 ), Vector2( 0, 0 ) ] | ||
} | ||
|
||
[sub_resource type="Animation" id=2] | ||
|
||
resource_name = "walk" | ||
length = 0.25 | ||
loop = false | ||
step = 0.05 | ||
tracks/0/type = "value" | ||
tracks/0/path = NodePath("Pivot/Sprite:self_modulate") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/imported = false | ||
tracks/0/enabled = false | ||
tracks/0/keys = { | ||
"times": PoolRealArray( 0, 0.1, 0.25 ), | ||
"transitions": PoolRealArray( 1, 1, 1 ), | ||
"update": 0, | ||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0.9375, 0, 1 ), Color( 1, 1, 1, 1 ) ] | ||
} | ||
tracks/1/type = "value" | ||
tracks/1/path = NodePath("Pivot/Sprite:position") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/keys = { | ||
"times": PoolRealArray( 0, 0.1, 0.15, 0.25 ), | ||
"transitions": PoolRealArray( 1, 0.303143, 2.61003, 1 ), | ||
"update": 0, | ||
"values": [ Vector2( 1.43051e-006, -1.90735e-006 ), Vector2( 1.43051e-006, -1.90735e-006 ), Vector2( 0, -20 ), Vector2( 1.43051e-006, -1.90735e-006 ) ] | ||
} | ||
tracks/2/type = "value" | ||
tracks/2/path = NodePath("Pivot/Sprite:scale") | ||
tracks/2/interp = 1 | ||
tracks/2/loop_wrap = true | ||
tracks/2/imported = false | ||
tracks/2/enabled = true | ||
tracks/2/keys = { | ||
"times": PoolRealArray( 0, 0.05, 0.15, 0.25 ), | ||
"transitions": PoolRealArray( 1, 0.354553, 1, 1 ), | ||
"update": 0, | ||
"values": [ Vector2( 1, 1 ), Vector2( 1.20007, 0.917384 ), Vector2( 0.916712, 1.13495 ), Vector2( 1, 1 ) ] | ||
} | ||
|
||
[sub_resource type="RectangleShape2D" id=3] | ||
|
||
custom_solver_bias = 0.0 | ||
extents = Vector2( 30, 30 ) | ||
|
||
[node name="Follower" type="KinematicBody2D"] | ||
position = Vector2( 32, 32 ) | ||
z_index = 1 | ||
input_pickable = false | ||
collision_layer = 1 | ||
collision_mask = 1 | ||
collision/safe_margin = 0.08 | ||
motion/sync_to_physics = false | ||
script = ExtResource( 1 ) | ||
|
||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] | ||
root_node = NodePath("..") | ||
autoplay = "" | ||
playback_process_mode = 1 | ||
playback_default_blend_time = 0.0 | ||
playback_speed = 1.0 | ||
anims/bump = SubResource( 1 ) | ||
anims/walk = SubResource( 2 ) | ||
blend_times = [ ] | ||
|
||
[node name="Tween" type="Tween" parent="."] | ||
repeat = false | ||
playback_process_mode = 1 | ||
playback_speed = 1.0 | ||
playback/active = false | ||
playback/repeat = false | ||
playback/speed = 1.0 | ||
|
||
[node name="Pivot" type="Position2D" parent="."] | ||
|
||
[node name="Sprite" type="Sprite" parent="Pivot"] | ||
position = Vector2( 1.43051e-006, -1.90735e-006 ) | ||
texture = ExtResource( 2 ) | ||
centered = false | ||
offset = Vector2( -32, -32 ) | ||
[node name="PawnAnim" parent="Pivot" instance=ExtResource( 2 )] | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
shape = SubResource( 3 ) | ||
shape = SubResource( 1 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters