* add Free Ball game mode and lobby selection * refactor base mode ball state tracking for reaped/sunk balls * add player ownership tracking and colored-ball support * add initial 9-ball mode implementation * update 8-ball and snooker modes to use base ball handling * replicate ball linear velocity for multiplayer synchronization * improve ball collision sound propagation and physics settings * reenable game music and initialize game signals * improve lobby input focus and mode selection behavior * adjust cue impulse origin and default game mode
40 lines
1.0 KiB
GDScript
40 lines
1.0 KiB
GDScript
class_name Snooker extends BaseMode
|
|
|
|
|
|
# NOTE: The game is sometimes played with fewer red balls- commonly 6 or 10.
|
|
# Normally, 15 red balls (1 point) and 6 balls of different colors:
|
|
# yellow (2 points), green (3), brown (4), blue (5), pink (6), black (7).
|
|
|
|
|
|
func reap_ball(ball: Node3D) -> void:
|
|
super(ball)
|
|
|
|
if is_colored_ball(ball.name):
|
|
# TODO: Colored ball must not be be destroyed. Handle rule...
|
|
pass
|
|
|
|
func process_ball(ball: Node3D) -> void:
|
|
super(ball)
|
|
|
|
if is_colored_ball(ball.name):
|
|
# TODO: Colored ball must not be be processed before red ball sunk.
|
|
# Handle rule...
|
|
pass
|
|
|
|
func handle_switch_user() -> void:
|
|
push_warning("Balls reaped: ", balls_reaped.size() )
|
|
push_warning("Balls sunk: ", balls_sunk.size() )
|
|
|
|
if not balls_reaped.is_empty():
|
|
# TODO: Handle points, etc
|
|
balls_reaped.clear()
|
|
|
|
if balls_sunk.is_empty():
|
|
Globals.game_state.switch_active_player()
|
|
return
|
|
|
|
# TODO: Handle points, etc
|
|
# Globals.multiplayer_data.current_turn_player_id
|
|
|
|
balls_sunk.clear()
|