bug fixes

This commit is contained in:
dingo
2026-01-20 18:37:23 -05:00
parent a39f4a0a98
commit 5aa92abce8
3 changed files with 42 additions and 14 deletions
+11 -4
View File
@@ -490,7 +490,11 @@ func _apply_tint(tint_hex: String):
fallback_sprite.modulate = tint_color
func play_hurt_effect():
"""Flash mob red briefly to show damage"""
"""Play hurt animation and flash mob red briefly to show damage"""
# Try to play hurt animation if available
if _animated_sprite and _animated_sprite.sprite_frames:
_play_animation("hurt", _facing_direction)
var sprite_to_flash = _animated_sprite if _animated_sprite and _animated_sprite.visible else fallback_sprite
if not sprite_to_flash:
@@ -512,15 +516,17 @@ func play_death_animation():
_current_state = "dead"
if _animated_sprite and _animated_sprite.sprite_frames:
# Try to play death animation
# Try to play death animation using the standard animation search
var frames = _animated_sprite.sprite_frames
var death_anim_name = ""
# Try different death animation names
# Try different death animation names with direction
var names_to_try = [
"dead_%s" % _facing_direction,
"dead",
"dead_%s" % _alt_direction(_facing_direction),
"death_%s" % _facing_direction,
"death_%s" % _alt_direction(_facing_direction),
"dead",
"death"
]
@@ -531,6 +537,7 @@ func play_death_animation():
if death_anim_name != "":
# Play the death animation
_last_animation = death_anim_name
_animated_sprite.play(death_anim_name)
# Wait for animation to finish
+18 -1
View File
@@ -14,12 +14,15 @@ var current_direction: String = "down" # down, up, left, right
func _ready():
# Sprite sheet will be loaded from CDN path: textures/player/Warrior-Blue.png
if UpdateManager:
# Try to load immediately (may already be cached)
var texture = UpdateManager.load_texture("textures/player/Warrior-Blue.png")
if texture:
print("[Player] Loaded sprite sheet texture")
_setup_sprite_frames(texture)
else:
print("[Player] Failed to load sprite sheet texture")
print("[Player] Failed to load sprite sheet texture, waiting for download...")
# Connect to file_downloaded signal to retry when file downloads
UpdateManager.file_downloaded.connect(_on_file_downloaded)
# Setup aim line (will be hidden once sprites load)
if aim_line:
@@ -38,6 +41,20 @@ func _ready():
if aim_line:
aim_line.visible = true
func _on_file_downloaded(file_path: String):
# Check if the player sprite was downloaded
if file_path == "textures/player/Warrior-Blue.png" and UpdateManager:
var texture = UpdateManager.load_texture("textures/player/Warrior-Blue.png")
if texture:
print("[Player] Loaded sprite sheet texture after download")
_setup_sprite_frames(texture)
# Start playing walk animation
if animated_sprite and animated_sprite.sprite_frames:
animated_sprite.play("walk_down")
# Hide aim line since we have sprites
if aim_line:
aim_line.visible = false
func _setup_sprite_frames(texture: Texture2D):
"""
Setup sprite frames from the Warrior-Blue sprite sheet