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
+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