multi animation track per char and secret of the single png to all frames

main
bel 2025-08-25 22:29:50 -06:00
parent 0da3a4eedc
commit 9c9fd7f91c
11 changed files with 272 additions and 0 deletions

View File

@ -0,0 +1,4 @@
root = true
[*]
charset = utf-8

View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

View File

@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
/android/

View File

@ -0,0 +1,25 @@
class_name Character extends CharacterBody2D
@export var speed := 135.0
# Xf2RduncoNU
func _physics_process(_delta: float) -> void:
var new_direction = Vector2.ZERO
if Input.is_action_pressed("left"):
new_direction.x -= 1.0
if Input.is_action_pressed("right"):
new_direction.x += 1.0
if Input.is_action_pressed("up"):
new_direction.y -= 1.0
if Input.is_action_pressed("down"):
new_direction.y += 1.0
new_direction = new_direction.normalized()
velocity = new_direction * speed
if velocity == Vector2.ZERO:
$AnimationTree.get("parameters/playback").travel("idle")
return
$AnimationTree.set("parameters/walk/blend_position", new_direction)
$AnimationTree.set("parameters/idle/blend_position", new_direction)
$AnimationTree.get("parameters/playback").travel("walk")
move_and_slide()

View File

@ -0,0 +1 @@
uid://csqcsepu2r0ts

View File

@ -0,0 +1,123 @@
[gd_scene load_steps=15 format=3 uid="uid://dbhiwig4potyb"]
[ext_resource type="Script" uid="uid://csqcsepu2r0ts" path="res://Entities/Character/character.gd" id="1_a1h5o"]
[ext_resource type="Texture2D" uid="uid://dasxw18q3mppl" path="res://icon.svg" id="1_bmc7m"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bmc7m"]
size = Vector2(14.8999, 28.4489)
[sub_resource type="Animation" id="Animation_a1h5o"]
resource_name = "new_animation"
length = 2.00005
loop_mode = 1
step = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Icon:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.01, 0.303333, 0.59, 0.86, 1.15, 1.44, 1.74),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [2, 1, 3, 4, 5, 6, 7]
}
[sub_resource type="Animation" id="Animation_xasj2"]
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Icon:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.01),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [5]
}
[sub_resource type="Animation" id="Animation_6vsl0"]
resource_name = "idle"
length = 0.333337
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Icon:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xasj2"]
_data = {
&"RESET": SubResource("Animation_xasj2"),
&"idle": SubResource("Animation_6vsl0"),
&"new_animation": SubResource("Animation_a1h5o")
}
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_a1h5o"]
animation = &"idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_xasj2"]
animation = &"new_animation"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6vsl0"]
animation = &"new_animation"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_k05qf"]
animation = &"idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4th1x"]
animation = &"idle"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_roimm"]
blend_point_0/node = SubResource("AnimationNodeAnimation_xasj2")
blend_point_0/pos = Vector2(-1, 0)
blend_point_1/node = SubResource("AnimationNodeAnimation_6vsl0")
blend_point_1/pos = Vector2(0, -0.9)
blend_point_2/node = SubResource("AnimationNodeAnimation_k05qf")
blend_point_2/pos = Vector2(0, 1)
blend_point_3/node = SubResource("AnimationNodeAnimation_4th1x")
blend_point_3/pos = Vector2(1, 0)
blend_mode = 1
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_roimm"]
states/idle/node = SubResource("AnimationNodeAnimation_a1h5o")
states/idle/position = Vector2(490, 105)
states/walk/node = SubResource("AnimationNodeBlendSpace2D_roimm")
states/walk/position = Vector2(490, 199)
[node name="Node2D" type="CharacterBody2D"]
scale = Vector2(1.00672, 0.989311)
script = ExtResource("1_a1h5o")
[node name="Icon" type="Sprite2D" parent="."]
position = Vector2(0.566751, -15.3349)
texture = ExtResource("1_bmc7m")
hframes = 6
vframes = 4
frame = 5
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0.496663, -14.0781)
scale = Vector2(0.999999, 1)
shape = SubResource("RectangleShape2D_bmc7m")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_xasj2")
}
[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource("AnimationNodeStateMachine_roimm")
anim_player = NodePath("../AnimationPlayer")
parameters/walk/blend_position = Vector2(-0.819838, -0.497758)

View File

@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://du7dcihv2m3ue"]
[ext_resource type="Texture2D" uid="uid://dasxw18q3mppl" path="res://icon.svg" id="1_sl5yh"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qnvor"]
size = Vector2(10, 129)
[node name="Wall" type="StaticBody2D"]
[node name="Icon" type="Sprite2D" parent="."]
position = Vector2(-1.90735e-06, -65)
scale = Vector2(0.078125, 1)
texture = ExtResource("1_sl5yh")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -64.5)
shape = SubResource("RectangleShape2D_qnvor")

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://bodk3sbrdedn2"]
[ext_resource type="PackedScene" uid="uid://dbhiwig4potyb" path="res://Entities/Character/character.tscn" id="1_uof5o"]
[ext_resource type="PackedScene" uid="uid://du7dcihv2m3ue" path="res://Entities/Objects/wall.tscn" id="2_6xle2"]
[node name="Playground" type="Node2D"]
[node name="character" parent="." instance=ExtResource("1_uof5o")]
[node name="wall" parent="." instance=ExtResource("2_6xle2")]
position = Vector2(245, 108)
scale = Vector2(3.35596, 3.35596)
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(0, -125)

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dasxw18q3mppl"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -0,0 +1,44 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="tutorial-oyvTZWUjCy0"
run/main_scene="uid://bodk3sbrdedn2"
config/features=PackedStringArray("4.4", "GL Compatibility")
config/icon="res://icon.svg"
[input]
up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}
left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}
down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}
right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"