added sideprofile animations

This commit is contained in:
2026-02-25 18:58:45 +01:00
parent d036169237
commit 602e5595ca
51 changed files with 835 additions and 201 deletions

View File

@@ -8,58 +8,8 @@ class_name Drone
@export var dodge_duration := 0.18
var dodge_duration_timer : Timer
#region animation dictionaries
@export var idle_anim_front : Dictionary
@export var idle_anim_back : Dictionary
@export var idle_anim_left : Dictionary
@export var idle_anim_right : Dictionary
@export var walking_anim_front : Dictionary
@export var walking_anim_back : Dictionary
@export var walking_anim_left : Dictionary
@export var walking_anim_right : Dictionary
@export var dashing_anim_front : Dictionary
@export var dashing_anim_back : Dictionary
@export var dashing_anim_left : Dictionary
@export var dashing_anim_right : Dictionary
@export var interacting_anim_front : Dictionary
@export var interacting_anim_back : Dictionary
@export var interacting_anim_left : Dictionary
@export var interacting_anim_right : Dictionary
var anim_dictionary_idle : Dictionary
var anim_dictionary_walking : Dictionary
var anim_dictionary_dashing : Dictionary
var anim_dictionary_interacting : Dictionary
#endregion
func _ready() -> void:
add_on_slots = 1
#region init animation dictionaries
anim_dictionary_idle.set(MachineGlobals.look_direction.UP, idle_anim_back)
anim_dictionary_idle.set(MachineGlobals.look_direction.DOWN, idle_anim_front)
anim_dictionary_idle.set(MachineGlobals.look_direction.LEFT, idle_anim_left)
anim_dictionary_idle.set(MachineGlobals.look_direction.RIGHT, idle_anim_right)
anim_dictionary_walking.set(MachineGlobals.look_direction.UP, walking_anim_back)
anim_dictionary_walking.set(MachineGlobals.look_direction.DOWN, walking_anim_front)
anim_dictionary_walking.set(MachineGlobals.look_direction.LEFT, walking_anim_left)
anim_dictionary_walking.set(MachineGlobals.look_direction.RIGHT, walking_anim_right)
anim_dictionary_interacting.set(MachineGlobals.look_direction.UP, interacting_anim_back)
anim_dictionary_interacting.set(MachineGlobals.look_direction.DOWN, interacting_anim_front)
anim_dictionary_interacting.set(MachineGlobals.look_direction.LEFT, interacting_anim_left)
anim_dictionary_interacting.set(MachineGlobals.look_direction.RIGHT, interacting_anim_right)
anim_dictionary_dashing.set(MachineGlobals.look_direction.UP, dashing_anim_back)
anim_dictionary_dashing.set(MachineGlobals.look_direction.DOWN, dashing_anim_front)
anim_dictionary_dashing.set(MachineGlobals.look_direction.LEFT, dashing_anim_left)
anim_dictionary_dashing.set(MachineGlobals.look_direction.RIGHT, dashing_anim_right)
#endregion
for a in self.get_children() :
if a.name == "DodgeDurationTimer" :
dodge_duration_timer = a
@@ -74,14 +24,14 @@ func class_ability() -> float:
func listen_to_animation_signals(next_anim_state : MachineGlobals.regular_states) -> void:
match next_anim_state :
MachineGlobals.regular_states.IDLING :
for a : AnimatedSprite2D in _get_body_parts() :
a.play(anim_dictionary_idle.get(look_dir).get(a.name))
for a : BodyPart in _get_body_parts() :
_animate(a,"Idle")
MachineGlobals.regular_states.WALKING :
for a : AnimatedSprite2D in _get_body_parts() :
a.play(anim_dictionary_walking.get(look_dir).get(a.name))
_animate(a,"Walking")
MachineGlobals.regular_states.DASHING :
for a : AnimatedSprite2D in _get_body_parts() :
a.play(anim_dictionary_dashing.get(look_dir).get(a.name))
_animate(a,"Dashing")
MachineGlobals.regular_states.INTERACTING :
for a : AnimatedSprite2D in _get_body_parts() :
a.play(anim_dictionary_interacting.get(look_dir).get(a.name))
_animate(a,"Interact")

View File

@@ -71,6 +71,11 @@ func _ability_process(delta:float) -> void :
func _get_body_parts() -> Array :
var clist : Array
for a in self.get_children() :
if a is AnimatedSprite2D :
if a is BodyPart :
clist.append(a)
return clist
func _animate(b : BodyPart, animation_type : String) -> void :
for anim_name : String in b.sprite_frames.get_animation_names() :
if anim_name.contains(animation_type) && anim_name.contains(model_name) && anim_name.contains(str(MachineGlobals.look_direction.keys()[look_dir])) :
b.play(anim_name)

View File

@@ -4,10 +4,16 @@
[ext_resource type="Texture2D" uid="uid://c3ks2krvhbeyx" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneBodyIdleFrontAndBack.png" id="2_1r2y7"]
[ext_resource type="Script" uid="uid://djmnqq6euiic8" path="res://Machines/Resources/Models/Drones/BaseDrone/base_drone.gd" id="2_njeil"]
[ext_resource type="Texture2D" uid="uid://dayqx8tgi4fj8" path="res://Machines/Sprites/Drones/BaseDrone/BaseDronBrain.png" id="2_tmd5t"]
[ext_resource type="Texture2D" uid="uid://cyvlqch8bby0v" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneBodyIdleLeft.png" id="4_2wo2i"]
[ext_resource type="Texture2D" uid="uid://b8cx4fmrgb83" path="res://Machines/Sprites/Drones/BaseDrone/base_drone_head_front_idle.png" id="4_njeil"]
[ext_resource type="Texture2D" uid="uid://bgr6yq60l5mjt" path="res://Machines/Sprites/Drones/BaseDrone/DefaultFuelTank.png" id="5_8l642"]
[ext_resource type="Texture2D" uid="uid://bdngqb6c81hm7" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneBodyIdleRight.png" id="5_nb8bv"]
[ext_resource type="Texture2D" uid="uid://dnthmyuq5e54" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneLegsFrontWalk.png" id="7_fkyu2"]
[ext_resource type="Texture2D" uid="uid://ctio2sfemdbag" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneLegsIdleFront.png" id="7_ogmjm"]
[ext_resource type="Texture2D" uid="uid://dx2dpf8hvj8wa" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneHeadLeft.png" id="9_h54wi"]
[ext_resource type="Texture2D" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneLegsWalkingSide.png" id="9_hvx52"]
[ext_resource type="Texture2D" uid="uid://yi1h6ghnf5ey" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneLegsWalkingRight.png" id="10_20g50"]
[ext_resource type="Texture2D" uid="uid://bb04dercpqua1" path="res://Machines/Sprites/Drones/BaseDrone/BaseDroneHeadRight.png" id="10_ua5ps"]
[sub_resource type="AtlasTexture" id="AtlasTexture_wbero"]
atlas = ExtResource("2_1r2y7")
@@ -17,6 +23,14 @@ region = Rect2(0, 0, 16, 16)
atlas = ExtResource("2_1r2y7")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_qjcig"]
atlas = ExtResource("4_2wo2i")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_7w12a"]
atlas = ExtResource("5_nb8bv")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_1r2y7"]
atlas = ExtResource("2_tmd5t")
region = Rect2(0, 0, 16, 16)
@@ -85,6 +99,22 @@ region = Rect2(0, 0, 16, 16)
atlas = ExtResource("4_njeil")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_0biru"]
atlas = ExtResource("9_h54wi")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_sukyw"]
atlas = ExtResource("9_h54wi")
region = Rect2(0, 16, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_g2sq0"]
atlas = ExtResource("10_ua5ps")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_j1wem"]
atlas = ExtResource("10_ua5ps")
region = Rect2(0, 16, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_vbgkk"]
atlas = ExtResource("7_ogmjm")
region = Rect2(0, 0, 16, 16)
@@ -113,6 +143,54 @@ region = Rect2(64, 5, 16, 11)
atlas = ExtResource("7_fkyu2")
region = Rect2(80, 5, 16, 11)
[sub_resource type="AtlasTexture" id="AtlasTexture_b1o6v"]
atlas = ExtResource("9_hvx52")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_8eqbb"]
atlas = ExtResource("9_hvx52")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_ope2v"]
atlas = ExtResource("9_hvx52")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_k67wn"]
atlas = ExtResource("9_hvx52")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_lxr7j"]
atlas = ExtResource("9_hvx52")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_5toxo"]
atlas = ExtResource("9_hvx52")
region = Rect2(80, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_gjxbl"]
atlas = ExtResource("10_20g50")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_gc6co"]
atlas = ExtResource("10_20g50")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_hkkxr"]
atlas = ExtResource("10_20g50")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_st3uv"]
atlas = ExtResource("10_20g50")
region = Rect2(80, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_0kd6c"]
atlas = ExtResource("10_20g50")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_phvch"]
atlas = ExtResource("10_20g50")
region = Rect2(48, 0, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_wbero"]
animations = [{
"frames": [{
@@ -123,11 +201,27 @@ animations = [{
"texture": SubResource("AtlasTexture_ny81s")
}],
"loop": true,
"name": &"base_body_idle_up_and_down",
"name": &"dbase_body_idle_up_and_down",
"speed": 1.5
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qjcig")
}],
"loop": true,
"name": &"dbase_body_walking_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_7w12a")
}],
"loop": true,
"name": &"dbase_body_walking_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1r2y7")
}, {
"duration": 1.0,
@@ -152,7 +246,7 @@ animations = [{
"texture": SubResource("AtlasTexture_20g50")
}],
"loop": true,
"name": &"base_brain_idle",
"name": &"dbase_brain_idle",
"speed": 5.0
}, {
"frames": [{
@@ -178,8 +272,8 @@ animations = [{
"texture": SubResource("AtlasTexture_6y0om")
}],
"loop": true,
"name": &"base_fueltank_idle",
"speed": 5.0
"name": &"dbase_fueltank_idle",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
@@ -189,7 +283,51 @@ animations = [{
"texture": SubResource("AtlasTexture_nb8bv")
}],
"loop": true,
"name": &"base_head_idle_front",
"name": &"dbase_head_idle_front",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0biru")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sukyw")
}],
"loop": true,
"name": &"dbase_head_idle_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_g2sq0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j1wem")
}],
"loop": true,
"name": &"dbase_head_idle_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0biru")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sukyw")
}],
"loop": true,
"name": &"dbase_head_walking_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_g2sq0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j1wem")
}],
"loop": true,
"name": &"dbase_head_walking_right",
"speed": 5.0
}, {
"frames": [{
@@ -197,7 +335,7 @@ animations = [{
"texture": SubResource("AtlasTexture_vbgkk")
}],
"loop": true,
"name": &"base_legs_idle_front",
"name": &"dbase_legs_idle_front",
"speed": 5.0
}, {
"frames": [{
@@ -220,7 +358,53 @@ animations = [{
"texture": SubResource("AtlasTexture_mvp03")
}],
"loop": true,
"name": &"base_legs_walking_front",
"name": &"dbase_legs_walking_front",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_b1o6v")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8eqbb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ope2v")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k67wn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lxr7j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5toxo")
}],
"loop": true,
"name": &"dbase_legs_walking_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_gjxbl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gc6co")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hkkxr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_st3uv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0kd6c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_phvch")
}],
"loop": true,
"name": &"dbase_legs_walking_right",
"speed": 5.0
}]
@@ -229,34 +413,30 @@ script = ExtResource("2_njeil")
model_name = &"Base"
movement_speed = 150.0
[node name="Brain" parent="." index="0" unique_id=1086286463]
position = Vector2(-4.7683716e-07, -0.9999995)
scale = Vector2(0.3125, 0.3125)
sprite_frames = SubResource("SpriteFrames_wbero")
animation = &"base_head_idle_front"
[node name="Camera2D" parent="." index="1" unique_id=2079743221]
zoom = Vector2(5, 5)
[node name="Fueltank" parent="." index="1" unique_id=1785702520]
position = Vector2(0, -1)
[node name="Fueltank" parent="." index="3" unique_id=1793167814]
position = Vector2(-1, -1)
scale = Vector2(0.75, 0.875)
sprite_frames = SubResource("SpriteFrames_wbero")
animation = &"base_fueltank_idle"
frame_progress = 0.79189146
animation = &"dbase_fueltank_idle"
[node name="Body" parent="." index="2" unique_id=963903106]
[node name="Body" parent="." index="4" unique_id=1950083426]
position = Vector2(-1, 1)
sprite_frames = SubResource("SpriteFrames_wbero")
animation = &"base_body_idle_up_and_down"
frame_progress = 0.20237787
animation = &"dbase_body_walking_right"
frame_progress = 0.7253901
[node name="Legs" parent="." index="3" unique_id=296150894]
position = Vector2(0, 1)
[node name="Head" parent="." index="5" unique_id=1860680538]
position = Vector2(-6, 0)
scale = Vector2(0.84375, 0.84375)
sprite_frames = SubResource("SpriteFrames_wbero")
animation = &"base_legs_walking_front"
animation = &"dbase_head_walking_left"
frame_progress = 0.95167845
[node name="Head" parent="." index="4" unique_id=2124844687]
position = Vector2(-2.842171e-14, -5.9604645e-08)
scale = Vector2(0.6875, 0.6875)
[node name="Legs" parent="." index="6" unique_id=1016206327]
position = Vector2(0, 3)
sprite_frames = SubResource("SpriteFrames_wbero")
animation = &"base_head_idle_front"
[node name="Camera2D" parent="." index="6" unique_id=2079743221]
zoom = Vector2(5, 5)
animation = &"dbase_legs_walking_left"
frame_progress = 0.3296052

View File

@@ -0,0 +1,10 @@
[gd_scene format=3 uid="uid://dts1g1ow3at0c"]
[ext_resource type="Script" uid="uid://wrdpxgpad8n4" path="res://Machines/Resources/Models/Drones/BodyParts/body_part.gd" id="1_a83i7"]
[sub_resource type="SpriteFrames" id="SpriteFrames_wps1t"]
[node name="BodyPart" type="AnimatedSprite2D" unique_id=1793167814]
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_wps1t")
script = ExtResource("1_a83i7")

View File

@@ -0,0 +1,2 @@
extends AnimatedSprite2D
class_name BodyPart

View File

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

View File

@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://ct30i3w56w0lo"]
[sub_resource type="SpriteFrames" id="SpriteFrames_bsvqd"]
[ext_resource type="PackedScene" uid="uid://dts1g1ow3at0c" path="res://Machines/Resources/Models/Drones/BodyParts/BodyPart.tscn" id="1_6pa52"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6pa52"]
size = Vector2(10, 8)
@@ -9,24 +9,17 @@ size = Vector2(10, 8)
texture_filter = 1
collision_layer = 3
[node name="Brain" type="AnimatedSprite2D" parent="." unique_id=1086286463]
sprite_frames = SubResource("SpriteFrames_bsvqd")
[node name="Fueltank" type="AnimatedSprite2D" parent="." unique_id=1785702520]
sprite_frames = SubResource("SpriteFrames_bsvqd")
[node name="Body" type="AnimatedSprite2D" parent="." unique_id=963903106]
sprite_frames = SubResource("SpriteFrames_bsvqd")
[node name="Legs" type="AnimatedSprite2D" parent="." unique_id=296150894]
sprite_frames = SubResource("SpriteFrames_bsvqd")
[node name="Head" type="AnimatedSprite2D" parent="." unique_id=2124844687]
sprite_frames = SubResource("SpriteFrames_bsvqd")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1475205819]
shape = SubResource("RectangleShape2D_6pa52")
[node name="Camera2D" type="Camera2D" parent="." unique_id=2079743221]
[node name="DodgeDurationTimer" type="Timer" parent="." unique_id=656287999]
[node name="Fueltank" parent="." unique_id=1793167814 instance=ExtResource("1_6pa52")]
[node name="Body" parent="." unique_id=1950083426 instance=ExtResource("1_6pa52")]
[node name="Head" parent="." unique_id=1860680538 instance=ExtResource("1_6pa52")]
[node name="Legs" parent="." unique_id=1016206327 instance=ExtResource("1_6pa52")]