feat: Implement initial main game scene with gridmap, player, and core managers.

This commit is contained in:
Yogi Wiguna
2026-03-12 12:30:29 +08:00
parent 412e7bdcdd
commit 3853962e4a
7 changed files with 1892 additions and 248 deletions
@@ -50,14 +50,6 @@ func after_action_completed():
# Only update UI if this is the LOCAL HUMAN PLAYER
# Bots are owned by the host (authority match) but shouldn't trigger UI updates
if multiplayer.get_unique_id() == player.get_multiplayer_authority():
if not player.is_bot and not player.is_in_group("Bots"):
var main = player.get_tree().get_root().get_node_or_null("Main")
if main:
main.ui_manager.update_playerboard_ui()
# Add this line to sync all boards
main.update_all_players_boards()
# Sync playerboard (Bots DO need to sync their board logic, just not update local UI)
if player.is_multiplayer_authority() and player.has_method("can_rpc") and player.can_rpc():
var main = player.get_tree().get_root().get_node_or_null("Main")
+4 -6
View File
@@ -260,8 +260,8 @@ func _execute_area_freeze(target_pos: Vector2i = Vector2i.ZERO):
var current_lvl = powerup_levels.get(SpecialEffect.AREA_FREEZE, 1)
if center_pos == Vector2i.ZERO:
# Updated: Always 3 tiles ahead as per user request
var distance = 3
# Updated: Always 4 tiles ahead as per user request
var distance = 4
print("[SpecialTiles] Area Freeze logic executing with distance: %d" % distance)
var movement = player.movement_manager
@@ -272,11 +272,9 @@ func _execute_area_freeze(target_pos: Vector2i = Vector2i.ZERO):
var last_dir = player.movement_manager.last_move_direction if movement else Vector2i(0, 1)
center_pos = player.current_position + last_dir * distance
# Allow spawning Area Freeze even out of bounds (user request)
if not enhanced_gridmap.is_position_valid(center_pos):
# Try a bit closer if out of bounds
center_pos = player.current_position + (center_pos - player.current_position).normalized() * 1.0
if not enhanced_gridmap.is_position_valid(center_pos):
return
print("[SpecialTiles] Spawning Area Freeze at out-of-bounds position: ", center_pos)
# 3. Determine Radius based on Level
var radius = 1
-17
View File
@@ -82,19 +82,6 @@ func _setup_btn(effect_id: int, btn: Button):
btn.size_flags_vertical = Control.SIZE_SHRINK_CENTER
btn.custom_minimum_size.y = 80 # Consistent height
# Add Level Label
if not btn.has_node("LevelLabel"):
var lvl_lbl = Label.new()
lvl_lbl.name = "LevelLabel"
lvl_lbl.mouse_filter = Control.MOUSE_FILTER_IGNORE
lvl_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
lvl_lbl.vertical_alignment = VERTICAL_ALIGNMENT_BOTTOM
lvl_lbl.set_anchors_preset(Control.PRESET_FULL_RECT)
lvl_lbl.add_theme_font_size_override("font_size", 16)
lvl_lbl.add_theme_color_override("font_outline_color", Color.BLACK)
lvl_lbl.add_theme_constant_override("outline_size", 4)
lvl_lbl.text = "" # Hidden initially
btn.add_child(lvl_lbl)
# Add Keyboard Shortcut Label
@@ -201,10 +188,6 @@ func _on_powerup_unlocked(effect: int, level: int):
btn.modulate = Color.WHITE # Restore color
btn.visible = true # Ensure visible
# Update Level
var lvl_lbl = btn.get_node_or_null("LevelLabel")
if lvl_lbl:
lvl_lbl.text = "Lvl %d" % level
# Enforce 1-slot rule by hiding others
if special_manager_ref: