feat: Add initial player character, movement, network synchronization, bot AI, and game managers.

This commit is contained in:
Yogi Wiguna
2026-02-24 16:54:45 +08:00
parent aa6d6dcec2
commit e31973dfab
7 changed files with 367 additions and 127 deletions
+18 -14
View File
@@ -55,7 +55,7 @@ func simple_move_to(grid_position: Vector2i) -> bool:
return false
if not player.is_multiplayer_authority():
# print("[Move] Failed: Not authority for ", player.name)
print("[Move] Failed: Not authority for %s (Authority: %d, My Peer: %d)" % [player.name, player.get_multiplayer_authority(), player.multiplayer.get_unique_id()])
return false
if player.get("is_frozen") or player.get("is_stop_frozen"):
@@ -144,7 +144,7 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
# === NEW LOGIC: Only allow push if in ATTACK MODE ===
if not player.get("is_attack_mode"):
# Standard bumping effect or nothing?
# User said "Remove standard push", so we just do nothing or small shake
print("[Move] Push blocked: Not in attack mode (%s trying to push)" % player.name)
return false
# === SUPER PUSH (Attack Mode) ===
@@ -196,19 +196,23 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
# Consume all available boost to force a full recharge cycle
player.powerup_manager.consume_boost(100.0)
# SCORING: 200 Points for successful attack
# SCORING: 200 Points for successful attack (ONLY in Free Mode)
if player.is_multiplayer_authority():
var main = player.get_tree().get_root().get_node_or_null("Main")
if main:
var gcm = main.get_node_or_null("GoalsCycleManager")
if gcm:
if multiplayer.is_server():
# Server/Bot: Directly add score to specific player ID
gcm.add_score(player.name.to_int(), 200)
else:
# Client: Request score add (sender ID used)
gcm.rpc("request_add_score", 200)
NotificationManager.send_message(player, "Successful Attack! +200 Pts", NotificationManager.MessageType.GOAL)
var is_sng = LobbyManager.game_mode == "Stop n Go"
if not is_sng:
var main = player.get_tree().get_root().get_node_or_null("Main")
if main:
var gcm = main.get_node_or_null("GoalsCycleManager")
if gcm:
if multiplayer.is_server():
# Server/Bot: Directly add score to specific player ID
gcm.add_score(player.name.to_int(), 200)
else:
# Client: Request score add (sender ID used)
gcm.rpc("request_add_score", 200)
NotificationManager.send_message(player, "Successful Attack! +200 Pts", NotificationManager.MessageType.GOAL)
else:
NotificationManager.send_message(player, "Successful Attack!", NotificationManager.MessageType.GOAL)
# 5. Attack Mode Persistence
# logic moved to consume_boost: checks if <= 0 then disables.