started adding architecture for CPU integration
This commit is contained in:
parent
29e88aaf75
commit
7fee99cce8
|
|
@ -172,7 +172,16 @@ y = WINDOW_HEIGHT / 2 - height / 2
|
|||
|
||||
start_button = Button(x, y - 100, width, height, "Start Game",
|
||||
primary_colour, hover_colour, text_colour,
|
||||
lambda *_: start_game(), font, 50, rounding=8)
|
||||
lambda *_: menu_manager.change_menu("mode_pick"),
|
||||
font, 50, rounding=8)
|
||||
|
||||
pvp_button = Button(x, y-height/1.5, width, height, "Player vs Player",
|
||||
primary_colour, hover_colour, text_colour,
|
||||
lambda *_: start_game("pvp"), font, 50, rounding=8)
|
||||
|
||||
pvc_button = Button(x, y+height/1.5, width, height, "Player vs CPU",
|
||||
primary_colour, hover_colour, text_colour,
|
||||
lambda *_: start_game("cpu"), font, 50, rounding=8)
|
||||
|
||||
settings_button = Button(x, y - 100 + height * 2, width, height, "Settings",
|
||||
primary_colour, hover_colour, text_colour,
|
||||
|
|
@ -194,14 +203,18 @@ game_over_text = Button(x, 50, width, height / 1.5, "text",
|
|||
None, font, 50, rounding=8)
|
||||
|
||||
# menu callbacks
|
||||
def start_game():
|
||||
global board_full, player, winner, cursor_col
|
||||
def start_game(mode):
|
||||
if mode == "pvp":
|
||||
global board_full, winner, player, cursor_col, last_tile
|
||||
board_full = False
|
||||
winner = None
|
||||
player = "red"
|
||||
cursor_col = COLS // 2
|
||||
last_tile = None
|
||||
create_tiles()
|
||||
menu_manager.change_menu("game")
|
||||
elif mode == "cpu":
|
||||
print("not implemented yet. give me money and i might make it fr")
|
||||
|
||||
def draw_settings(display):
|
||||
text_surface = font.render("No settings yet :(", True, text_colour)
|
||||
|
|
@ -289,6 +302,10 @@ menu_manager.register_menu("start",
|
|||
buttons=[start_button, settings_button]
|
||||
)
|
||||
|
||||
menu_manager.register_menu("mode_pick",
|
||||
buttons=[pvp_button, pvc_button]
|
||||
)
|
||||
|
||||
menu_manager.register_menu("settings",
|
||||
buttons=[go_back_button],
|
||||
draw=draw_settings
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user