CDN Integration Mobs

This commit is contained in:
dingo
2025-12-20 16:42:19 -05:00
parent 9d990b8c18
commit 7c29268fa4
13 changed files with 1414 additions and 51 deletions
+3 -38
View File
@@ -1,46 +1,12 @@
[gd_scene load_steps=3 format=3]
[gd_scene load_steps=3 format=3 uid="uid://4it2xruff84i"]
[sub_resource type="GDScript" id="GDScript_mob"]
script/source = "extends Node2D
@onready var sprite: Sprite2D = $Sprite
@onready var name_label: Label = $NameLabel
@onready var health_bar: ProgressBar = $HealthBar
var mob_data: Dictionary = {}
func _ready():
# Get texture from generator if available
if SpriteGenerator:
sprite.texture = SpriteGenerator.get_circle()
# Default mob color (red)
sprite.modulate = Color(0.67, 0.27, 0.27) # #aa4444
func update_data(data: Dictionary):
mob_data = data
var mname = data.get(\"name\", data.get(\"Name\", \"Mob\"))
name_label.text = mname
var hp = data.get(\"health\", data.get(\"Health\", 100))
var max_hp = data.get(\"maxHealth\", data.get(\"MaxHealth\", 100))
health_bar.max_value = max_hp
health_bar.value = hp
# Change color based on state
var state = str(data.get(\"state\", data.get(\"State\", \"idle\"))).to_lower()
if state == \"attacking\":
sprite.modulate = Color(1.0, 0.4, 0.4) # Bright red when attacking
else:
sprite.modulate = Color(0.67, 0.27, 0.27) # Normal red
"
[ext_resource type="Script" uid="uid://b0rmvppejqbkq" path="res://scripts/dungeon/mob_visual.gd" id="1_hxp1t"]
[sub_resource type="CircleShape2D" id="CircleShape2D_1"]
radius = 14.0
[node name="Mob" type="Node2D"]
script = SubResource("GDScript_mob")
script = ExtResource("1_hxp1t")
[node name="Sprite" type="Sprite2D" parent="."]
modulate = Color(0.667, 0.267, 0.267, 1)
@@ -59,7 +25,6 @@ offset_left = -20.0
offset_top = -28.0
offset_right = 20.0
offset_bottom = -23.0
max_value = 100.0
value = 100.0
show_percentage = false
+514
View File
@@ -0,0 +1,514 @@
[gd_scene load_steps=68 format=3 uid="uid://bujdna7jnqkby"]
[ext_resource type="Texture2D" uid="uid://bh5hiktaq3n0d" path="res://assets/sprites/skeleton_idle_front.png" id="1_pploe"]
[ext_resource type="Texture2D" uid="uid://d1tduvr5dgalw" path="res://assets/sprites/skeleton_idle_left.png" id="2_hx7r7"]
[ext_resource type="Texture2D" uid="uid://cledey0ulf2ug" path="res://assets/sprites/skeleton_idle_right.png" id="3_veie2"]
[ext_resource type="Texture2D" uid="uid://cw6qmlsxbh6p6" path="res://assets/sprites/skeleton_idle_back.png" id="4_sl27l"]
[ext_resource type="Texture2D" uid="uid://c0htjdiwhxqke" path="res://assets/sprites/skeleton_run_down.png" id="5_k6hkq"]
[ext_resource type="Texture2D" uid="uid://ehyta407mq35" path="res://assets/sprites/skeleton_run_left.png" id="6_41lny"]
[ext_resource type="Texture2D" uid="uid://csguviflpidje" path="res://assets/sprites/skeleton_run_right.png" id="7_0esl7"]
[ext_resource type="Texture2D" uid="uid://d3p0msvqnljlh" path="res://assets/sprites/skeleton_run_up.png" id="8_fqkji"]
[sub_resource type="GDScript" id="GDScript_mob"]
script/source = "extends Node2D
@onready var sprite: Sprite2D = $Sprite
@onready var name_label: Label = $NameLabel
@onready var health_bar: ProgressBar = $HealthBar
var mob_data: Dictionary = {}
func _ready():
# Get texture from generator if available
if SpriteGenerator:
sprite.texture = SpriteGenerator.get_circle()
# Default mob color (red)
sprite.modulate = Color(0.67, 0.27, 0.27) # #aa4444
func update_data(data: Dictionary):
mob_data = data
var mname = data.get(\"name\", data.get(\"Name\", \"Mob\"))
name_label.text = mname
var hp = data.get(\"health\", data.get(\"Health\", 100))
var max_hp = data.get(\"maxHealth\", data.get(\"MaxHealth\", 100))
health_bar.max_value = max_hp
health_bar.value = hp
# Change color based on state
var state = str(data.get(\"state\", data.get(\"State\", \"idle\"))).to_lower()
if state == \"attacking\":
sprite.modulate = Color(1.0, 0.4, 0.4) # Bright red when attacking
else:
sprite.modulate = Color(0.67, 0.27, 0.27) # Normal red
"
[sub_resource type="AtlasTexture" id="AtlasTexture_k6hkq"]
atlas = ExtResource("1_pploe")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_41lny"]
atlas = ExtResource("1_pploe")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_0esl7"]
atlas = ExtResource("1_pploe")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_fqkji"]
atlas = ExtResource("1_pploe")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_fhgn5"]
atlas = ExtResource("1_pploe")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_frtn7"]
atlas = ExtResource("1_pploe")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_7g40e"]
atlas = ExtResource("1_pploe")
region = Rect2(384, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_5vh58"]
atlas = ExtResource("1_pploe")
region = Rect2(448, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_qu4fx"]
atlas = ExtResource("2_hx7r7")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_e7ee1"]
atlas = ExtResource("2_hx7r7")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_yid88"]
atlas = ExtResource("2_hx7r7")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_dr8o3"]
atlas = ExtResource("2_hx7r7")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_6820b"]
atlas = ExtResource("2_hx7r7")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_mcth8"]
atlas = ExtResource("2_hx7r7")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_rjmc8"]
atlas = ExtResource("2_hx7r7")
region = Rect2(384, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_35mp6"]
atlas = ExtResource("2_hx7r7")
region = Rect2(448, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ri13g"]
atlas = ExtResource("3_veie2")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_odhcy"]
atlas = ExtResource("3_veie2")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bj50m"]
atlas = ExtResource("3_veie2")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_8amur"]
atlas = ExtResource("3_veie2")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_b3w3k"]
atlas = ExtResource("3_veie2")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_oaxiq"]
atlas = ExtResource("3_veie2")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bmdme"]
atlas = ExtResource("3_veie2")
region = Rect2(384, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_7tnq4"]
atlas = ExtResource("3_veie2")
region = Rect2(448, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_si4oc"]
atlas = ExtResource("4_sl27l")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_h8v16"]
atlas = ExtResource("4_sl27l")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_6fmny"]
atlas = ExtResource("4_sl27l")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_i5pwu"]
atlas = ExtResource("4_sl27l")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_r8f14"]
atlas = ExtResource("4_sl27l")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_lsr2m"]
atlas = ExtResource("4_sl27l")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_8skex"]
atlas = ExtResource("4_sl27l")
region = Rect2(384, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_l6pfv"]
atlas = ExtResource("4_sl27l")
region = Rect2(448, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_1mdy3"]
atlas = ExtResource("5_k6hkq")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ebcfk"]
atlas = ExtResource("5_k6hkq")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_t3iib"]
atlas = ExtResource("5_k6hkq")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ufa5r"]
atlas = ExtResource("5_k6hkq")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_35paj"]
atlas = ExtResource("5_k6hkq")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_svn5s"]
atlas = ExtResource("5_k6hkq")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_je3uc"]
atlas = ExtResource("6_41lny")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_lus8e"]
atlas = ExtResource("6_41lny")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_4x2ba"]
atlas = ExtResource("6_41lny")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_r1whh"]
atlas = ExtResource("6_41lny")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_m680v"]
atlas = ExtResource("6_41lny")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_5v31e"]
atlas = ExtResource("6_41lny")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_vsoff"]
atlas = ExtResource("7_0esl7")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_jafuc"]
atlas = ExtResource("7_0esl7")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_fs722"]
atlas = ExtResource("7_0esl7")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_iolbg"]
atlas = ExtResource("7_0esl7")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_4grvp"]
atlas = ExtResource("7_0esl7")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_c7xha"]
atlas = ExtResource("7_0esl7")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_bqs0e"]
atlas = ExtResource("8_fqkji")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_q4l2n"]
atlas = ExtResource("8_fqkji")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_il1ms"]
atlas = ExtResource("8_fqkji")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ici58"]
atlas = ExtResource("8_fqkji")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ffrgp"]
atlas = ExtResource("8_fqkji")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_sgvb2"]
atlas = ExtResource("8_fqkji")
region = Rect2(320, 0, 64, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_0esl7"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_k6hkq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_41lny")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0esl7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fqkji")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fhgn5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_frtn7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7g40e")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5vh58")
}],
"loop": true,
"name": &"idle_down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qu4fx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e7ee1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yid88")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dr8o3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6820b")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mcth8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rjmc8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_35mp6")
}],
"loop": true,
"name": &"idle_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ri13g")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_odhcy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bj50m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8amur")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_b3w3k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oaxiq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bmdme")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7tnq4")
}],
"loop": false,
"name": &"idle_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_si4oc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_h8v16")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6fmny")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_i5pwu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r8f14")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lsr2m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8skex")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l6pfv")
}],
"loop": true,
"name": &"idle_up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1mdy3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ebcfk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t3iib")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ufa5r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_35paj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_svn5s")
}],
"loop": true,
"name": &"walk_down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_je3uc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lus8e")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4x2ba")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r1whh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_m680v")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5v31e")
}],
"loop": true,
"name": &"walk_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_vsoff")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jafuc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fs722")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_iolbg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4grvp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_c7xha")
}],
"loop": true,
"name": &"walk_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_bqs0e")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_q4l2n")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_il1ms")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ici58")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ffrgp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sgvb2")
}],
"loop": true,
"name": &"walk_up",
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_1"]
radius = 14.0
[node name="Mob" type="Node2D"]
script = SubResource("GDScript_mob")
[node name="Sprite" type="Sprite2D" parent="."]
modulate = Color(0.667, 0.267, 0.267, 1)
scale = Vector2(1.4749995, 1.4749995)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Sprite"]
sprite_frames = SubResource("SpriteFrames_0esl7")
animation = &"walk_up"
[node name="NameLabel" type="Label" parent="."]
offset_left = -50.0
offset_top = -35.0
offset_right = 50.0
offset_bottom = -20.0
horizontal_alignment = 1
vertical_alignment = 1
[node name="HealthBar" type="ProgressBar" parent="."]
offset_left = -20.0
offset_top = -28.0
offset_right = 20.0
offset_bottom = -23.0
value = 100.0
show_percentage = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_1")