Add slime animation controller
This commit is contained in:
parent
0c570d8959
commit
af90e9390a
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
slime: https://quaternius.itch.io/lowpoly-animated-animals
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -1,10 +1,10 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://3d51hjh2st8a"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d3ccrfjpg4hbv" path="res://Models/palm_curved.tscn" id="3_bth2b"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1n2lfcn4rkx7" path="res://Models/palm_default.tscn" id="4_2cnue"]
|
||||
[ext_resource type="PackedScene" path="res://Models/palm_default.tscn" id="4_2cnue"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctbyl0qbks4k6" path="res://Models/ocean.tscn" id="4_dey2i"]
|
||||
[ext_resource type="PackedScene" uid="uid://difi2tur2j4dg" path="res://Models/island.tscn" id="4_lq6cy"]
|
||||
[ext_resource type="PackedScene" uid="uid://hg1yr5rnxd47" path="res://Models/palm_young.tscn" id="5_prlw2"]
|
||||
[ext_resource type="PackedScene" path="res://Models/palm_young.tscn" id="5_prlw2"]
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
|
||||
|
||||
func walk():
|
||||
animation_state.travel("Walk")
|
||||
|
||||
func idle():
|
||||
animation_state.travel("Idle")
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,44 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://c3q6fva1c1baa"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://biuw6lh16d2qr" path="res://Models/slime.glb" id="1_jttw0"]
|
||||
[ext_resource type="Script" path="res://Models/slime.gd" id="2_xo27e"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nwfvl"]
|
||||
animation = &"Slime_Idle"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_avpkh"]
|
||||
animation = &"Slime_Walk"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_y7liq"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_n3s05"]
|
||||
xfade_time = 0.3
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fbi2x"]
|
||||
xfade_time = 0.3
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_prt7l"]
|
||||
states/Idle/node = SubResource("AnimationNodeAnimation_nwfvl")
|
||||
states/Idle/position = Vector2(570, 145)
|
||||
states/Walk/node = SubResource("AnimationNodeAnimation_avpkh")
|
||||
states/Walk/position = Vector2(329, 155)
|
||||
transitions = ["Start", "Walk", SubResource("AnimationNodeStateMachineTransition_y7liq"), "Walk", "Idle", SubResource("AnimationNodeStateMachineTransition_n3s05"), "Idle", "Walk", SubResource("AnimationNodeStateMachineTransition_fbi2x")]
|
||||
|
||||
[node name="slime" instance=ExtResource("1_jttw0")]
|
||||
script = ExtResource("2_xo27e")
|
||||
|
||||
[node name="Skeleton3D" parent="Armature" index="0"]
|
||||
bones/1/position = Vector3(0, 0.410324, 0)
|
||||
bones/2/position = Vector3(0.00236768, 0.44386, 0.00104018)
|
||||
bones/2/rotation = Quaternion(-0.0371253, -0.00167519, -0.213342, 0.976271)
|
||||
bones/3/rotation = Quaternion(0.104013, -0.697591, 0.00939198, 0.708844)
|
||||
bones/7/rotation = Quaternion(-0.301863, 2.16678e-09, 2.86589e-09, 0.953351)
|
||||
bones/8/rotation = Quaternion(0.186806, -9.15072e-10, -4.81489e-10, 0.982397)
|
||||
bones/10/rotation = Quaternion(0.183918, -5.22532e-08, 1.09779e-08, 0.982942)
|
||||
bones/11/rotation = Quaternion(0.0467994, 9.84262e-08, 4.31854e-08, 0.998904)
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="." index="2"]
|
||||
tree_root = SubResource("AnimationNodeStateMachine_prt7l")
|
||||
anim_player = NodePath("../AnimationPlayer")
|
||||
active = true
|
|
@ -1,22 +1,13 @@
|
|||
extends Node3D
|
||||
|
||||
|
||||
|
||||
func _on_pickup_pressed():
|
||||
$grape_man.pickup()
|
||||
|
||||
|
||||
func _on_drop_pressed():
|
||||
$grape_man.drop()
|
||||
|
||||
|
||||
func _on_idle_pressed():
|
||||
$grape_man.idle()
|
||||
|
||||
|
||||
func _on_walk_pressed():
|
||||
$grape_man.walk()
|
||||
|
||||
|
||||
func _on_hold_pressed():
|
||||
$grape_man.hold()
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
extends Node3D
|
||||
|
||||
func _on_idle_pressed():
|
||||
$slime.idle()
|
||||
|
||||
func _on_walk_pressed():
|
||||
$slime.walk()
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cncrqbk7egbdy"]
|
||||
|
||||
[ext_resource type="Script" path="res://tests/test_slime_animation.gd" id="1_eeubk"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q6fva1c1baa" path="res://Models/slime.tscn" id="2_fqm0o"]
|
||||
|
||||
[node name="test_slime_animation" type="Node3D"]
|
||||
script = ExtResource("1_eeubk")
|
||||
|
||||
[node name="slime" parent="." instance=ExtResource("2_fqm0o")]
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Control" type="Control" parent="CanvasLayer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 11.0
|
||||
offset_top = 15.0
|
||||
offset_right = -768.0
|
||||
offset_bottom = 15.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Idle" type="Button" parent="CanvasLayer/Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Idle"
|
||||
|
||||
[node name="Walk" type="Button" parent="CanvasLayer/Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Walk"
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(0.999682, 0, -0.0251998, 0, 1, 0, 0.0251998, 0, 0.999682, 0.262823, 2.33598, 7.32455)
|
||||
current = true
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Idle" to="." method="_on_idle_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Walk" to="." method="_on_walk_pressed"]
|
Loading…
Reference in New Issue