feat: Introduce player movement manager with push mechanics, multiplayer synchronization, and new touch controls and powerup inventory UI.

This commit is contained in:
Yogi Wiguna
2026-03-10 11:05:14 +08:00
parent aaf246d873
commit da7192ac07
3 changed files with 39 additions and 16 deletions
+15 -9
View File
@@ -166,6 +166,21 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
player.sync_bump(target_pos, true)
return false
# SAFE ZONE PROTECTION (Only in Stop n Go)
if LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO):
var safe_columns = [6, 7, 8, 14, 15, 16]
# 1. Prevent attacker from attacking IF THEY ARE in a Safe Zone
if player.current_position.x in safe_columns:
print(" - Attack BLOCKED: Attacker is in Safe Zone!")
NotificationManager.send_message(player, "Cannot Attack while in Safe Zone!", NotificationManager.MessageType.WARNING)
return false
# 2. Prevent attacking players WHO ARE in a Safe Zone (existing logic)
if target_pos.x in safe_columns:
print(" - Attack BLOCKED: Target is in Safe Zone!")
NotificationManager.send_message(player, "Target is in Safe Zone!", NotificationManager.MessageType.WARNING)
return false
# === SUPER PUSH (Attack Mode) ===
print("Player %s SUPER PUSHING %s!" % [player.name, other_player.name])
@@ -175,15 +190,6 @@ func try_push(target_pos: Vector2i, direction: Vector2i) -> bool:
elif player.has_method("sync_bump"):
player.sync_bump(target_pos, false)
# SAFE ZONE PROTECTION (Only in Stop n Go)
if LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO):
# Columns 6, 7, 8 and 14, 15, 16 are Safe Zones
var safe_columns = [6, 7, 8, 14, 15, 16]
if target_pos.x in safe_columns:
print(" - Attack BLOCKED by Safe Zone!")
NotificationManager.send_message(player, "Cannot Attack in Safe Zone!", NotificationManager.MessageType.WARNING)
return false
# 1. 3-Floor Knockback towards Starting Line (X=0)
var push_direction = Vector2i(-1, 0) # Backwards
var pushed_to_pos = target_pos