This commit is contained in:
2026-01-11 13:26:12 +01:00
parent 07a7ed3bca
commit 26de2ca6e0
7 changed files with 80 additions and 8 deletions

View File

@@ -25,6 +25,14 @@ func _ready():
info_label.add_theme_color_override("font_color", Color.WHITE) info_label.add_theme_color_override("font_color", Color.WHITE)
info_label.add_theme_font_size_override("font_size", 20) info_label.add_theme_font_size_override("font_size", 20)
info_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT info_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
# Load standard_font.png as bitmap font
var standard_font_resource = null
if ResourceLoader.exists("res://assets/fonts/standard_font.png"):
standard_font_resource = load("res://assets/fonts/standard_font.png")
if standard_font_resource:
info_label.add_theme_font_override("font", standard_font_resource)
add_child(info_label) add_child(info_label)
# Position in top right # Position in top right

View File

@@ -148,8 +148,8 @@ func generate_dungeon(map_size: Vector2i, seed_value: int = 0, level: int = 1) -
if rng.randf() < 0.3: # 30% chance for a hole if rng.randf() < 0.3: # 30% chance for a hole
_add_hole_to_room(room, grid, tile_grid, map_size, rng) _add_hole_to_room(room, grid, tile_grid, map_size, rng)
# 5. Mark start room (first room) # 5. Mark start room (random room for variety)
var start_room_index = 0 var start_room_index = rng.randi() % all_rooms.size()
var exit_room_index = -1 # Declare exit_room_index early to avoid scope issues var exit_room_index = -1 # Declare exit_room_index early to avoid scope issues
all_rooms[start_room_index].modifiers.append({"type": "START"}) all_rooms[start_room_index].modifiers.append({"type": "START"})

View File

@@ -181,12 +181,29 @@ func _damaged_behavior(_delta):
state_timer = idle_duration state_timer = idle_duration
func _set_animation(anim_name: String): func _set_animation(anim_name: String):
# Validate animation exists before setting it
if anim_name in ANIMATIONS:
if current_animation != anim_name: if current_animation != anim_name:
current_animation = anim_name current_animation = anim_name
current_frame = 0 current_frame = 0
time_since_last_frame = 0.0 time_since_last_frame = 0.0
else:
# Invalid animation name - fall back to IDLE
print("EnemySlime: Invalid animation '", anim_name, "' - falling back to IDLE")
if current_animation != "IDLE":
current_animation = "IDLE"
current_frame = 0
time_since_last_frame = 0.0
func _update_animation(delta): func _update_animation(delta):
# Safety check: ensure current_animation exists in ANIMATIONS
if not current_animation in ANIMATIONS:
print("EnemySlime: ERROR - current_animation '", current_animation, "' not in ANIMATIONS! Resetting to IDLE")
current_animation = "IDLE"
current_frame = 0
time_since_last_frame = 0.0
return
# Update animation frame timing # Update animation frame timing
time_since_last_frame += delta time_since_last_frame += delta
if time_since_last_frame >= ANIMATIONS[current_animation]["frameDurations"][current_frame] / 1000.0: if time_since_last_frame >= ANIMATIONS[current_animation]["frameDurations"][current_frame] / 1000.0:

View File

@@ -44,23 +44,39 @@ func _ready():
func _check_command_line_args(): func _check_command_line_args():
var args = OS.get_cmdline_args() var args = OS.get_cmdline_args()
print("GameUI: Parsing command-line arguments: ", args)
# Parse arguments # Parse arguments
var should_host = false var should_host = false
var should_join = false var should_join = false
var should_debug = false
var join_address = "127.0.0.1" var join_address = "127.0.0.1"
var local_count = 1 var local_count = 1
for arg in args: for arg in args:
if arg == "--host": if arg == "--host":
should_host = true should_host = true
print("GameUI: Found --host argument")
elif arg == "--join": elif arg == "--join":
should_join = true should_join = true
print("GameUI: Found --join argument")
elif arg == "--room-debug":
should_debug = true
print("GameUI: Found --room-debug argument")
elif arg.begins_with("--address="): elif arg.begins_with("--address="):
join_address = arg.split("=")[1] join_address = arg.split("=")[1]
elif arg.begins_with("--players="): elif arg.begins_with("--players="):
local_count = int(arg.split("=")[1]) local_count = int(arg.split("=")[1])
print("GameUI: Parsed flags - should_host: ", should_host, ", should_join: ", should_join, ", should_debug: ", should_debug)
# Set debug flag only if --room-debug is used with --host or --join
if should_debug and (should_host or should_join):
network_manager.show_room_labels = true
print("Debug mode enabled: room labels will be shown")
else:
print("GameUI: Debug mode NOT enabled - should_debug: ", should_debug, ", should_host: ", should_host, ", should_join: ", should_join)
# Auto-start based on arguments # Auto-start based on arguments
if should_host: if should_host:
print("Auto-hosting due to --host argument") print("Auto-hosting due to --host argument")

View File

@@ -535,9 +535,9 @@ func _generate_dungeon():
print("GameWorld: Generating dungeon level ", current_level) print("GameWorld: Generating dungeon level ", current_level)
# Generate seed (deterministic for level 1, can be random for future levels) # Generate seed (random for all levels)
if dungeon_seed == 0: if dungeon_seed == 0:
dungeon_seed = randi() if current_level > 1 else 12345 # Fixed seed for level 1 for testing dungeon_seed = randi()
# Create dungeon generator # Create dungeon generator
var generator = load("res://scripts/dungeon_generator.gd").new() var generator = load("res://scripts/dungeon_generator.gd").new()
@@ -2146,6 +2146,15 @@ func _create_level_text_ui_programmatically() -> Node:
var vbox = VBoxContainer.new() var vbox = VBoxContainer.new()
vbox.set_anchors_preset(Control.PRESET_CENTER) vbox.set_anchors_preset(Control.PRESET_CENTER)
# Center horizontally and position higher up
var screen_size = get_viewport().get_visible_rect().size
vbox.offset_left = -screen_size.x / 2
vbox.offset_right = screen_size.x / 2
vbox.offset_top = -250 # Position higher up from center
vbox.offset_bottom = screen_size.y / 2 - 250
vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL # Expand to fill width for proper centering
canvas_layer.add_child(vbox) canvas_layer.add_child(vbox)
# Level label # Level label
@@ -2154,6 +2163,15 @@ func _create_level_text_ui_programmatically() -> Node:
level_label.text = "LEVEL 1" level_label.text = "LEVEL 1"
level_label.add_theme_font_size_override("font_size", 64) level_label.add_theme_font_size_override("font_size", 64)
level_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER level_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
level_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL # Expand to center properly
# Load standard_font.png as bitmap font
var standard_font_resource = null
if ResourceLoader.exists("res://assets/fonts/standard_font.png"):
standard_font_resource = load("res://assets/fonts/standard_font.png")
if standard_font_resource:
level_label.add_theme_font_override("font", standard_font_resource)
vbox.add_child(level_label) vbox.add_child(level_label)
# Add script # Add script

View File

@@ -14,6 +14,7 @@ const MAX_PLAYERS = 8
var players_info = {} # Dictionary of peer_id -> {local_player_count: int, player_names: []} var players_info = {} # Dictionary of peer_id -> {local_player_count: int, player_names: []}
var local_player_count = 1 # How many local players on this machine var local_player_count = 1 # How many local players on this machine
var is_hosting = false var is_hosting = false
var show_room_labels = false # Show room labels when in debug mode
func _ready(): func _ready():
# Connect multiplayer signals # Connect multiplayer signals

View File

@@ -26,6 +26,7 @@ func _ready():
call_deferred("_find_room_entities") call_deferred("_find_room_entities")
# Create debug label (deferred to avoid blocking on font load during startup) # Create debug label (deferred to avoid blocking on font load during startup)
# Only create if debug mode is enabled
call_deferred("_create_debug_label") call_deferred("_create_debug_label")
func _on_body_entered(body): func _on_body_entered(body):
@@ -426,6 +427,17 @@ func _find_room_spawners():
func _create_debug_label(): func _create_debug_label():
# Create a debug label to show puzzle type and trigger status above the room # Create a debug label to show puzzle type and trigger status above the room
# Only create if debug mode is enabled
var network_manager = get_node_or_null("/root/NetworkManager")
if not network_manager:
print("RoomTrigger: NetworkManager not found, skipping debug label")
return
if not network_manager.show_room_labels:
print("RoomTrigger: Debug mode not enabled (show_room_labels = false), skipping debug label for room (", room.x, ", ", room.y, ")")
return
print("RoomTrigger: Creating debug label for room (", room.x, ", ", room.y, ") - debug mode enabled")
# Skip if label already exists # Skip if label already exists
if debug_label and is_instance_valid(debug_label): if debug_label and is_instance_valid(debug_label):
return return