Skip to content

Commit

Permalink
imgs
Browse files Browse the repository at this point in the history
  • Loading branch information
whyismynamerudy committed Jan 28, 2024
1 parent 23ae9ff commit 2e2d51f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ def find_and_return_random_files(folder_path):
# print_tree(root)

# run_game()
start_screen.main_menu(screen, root)
start_screen.main_menu(screen, root, imgs)
47 changes: 35 additions & 12 deletions start_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def get_logo(size):
return pygame.font.Font("assets/fonts/pacman_font.TTF", size)


def main_menu(screen, root):
def main_menu(screen, root, imgs):
screen = pygame.display.set_mode([900, 950])
pygame.display.set_caption("Menu")

MENU_TEXT = get_font(85).render("MAIN MENU", True, "White")
MENU_RECT = MENU_TEXT.get_rect(center=(450, 330))

LOGO_TEXT = get_logo(100).render("TU-PAC", True, "Yellow")
LOGO_TEXT = get_logo(100).render("TWO-PAC", True, "Yellow")
LOGO_RECT = LOGO_TEXT.get_rect(center=(450, 180))

START_TEXT = get_font(50).render("START[S]", True, "Blue")
Expand Down Expand Up @@ -48,10 +48,35 @@ def main_menu(screen, root):
if wl:
print("won level")
vic_track.append(('Won', 4))
change_screen_win_screen()
change_screen_win_screen(wl)
wl, num_shards = pacman.run_game(root.right, 0, None)
if wl:
# won second game
vic_track.append(('Won', 4))
change_screen_win_screen(wl)
wl, num_shards = pacman.run_game(root.right.right, 0, None)
else:
# lost second game
vic_track.append(('Loss', num_shards))
change_screen_win_screen(wl)
wl, num_shards = pacman.run_game(root.right.left, 0, None)

else:
print("lost level")
vic_track.append(('Loss', num_shards))
change_screen_win_screen(wl)
wl, num_shards = pacman.run_game(root.left, 0, None)
if wl:
# won second game
vic_track.append(('Won', 4))
change_screen_win_screen(wl)
wl, num_shards = pacman.run_game(root.left.right, 0, None)
else:
# lost second game
vic_track.append(('Loss', num_shards))
change_screen_win_screen(wl)
wl, num_shards = pacman.run_game(root.left.left, 0, None)

elif event.key == pygame.K_p:
# xxx.run()
# TODO: show photos
Expand All @@ -61,20 +86,18 @@ def main_menu(screen, root):

pygame.quit()

def change_screen_win_screen():
def change_screen_win_screen(wl):
screen = pygame.display.set_mode([900, 950])
half_height = screen.get_height//2
half_width = screen.get_width//2
half_height = screen.get_height()//2
half_width = screen.get_width()//2

RESULT = get_font(85).render(f"You ", True, "White")
RESULT_RECT = RESULT.get_rect(center=(half_width, 100))

half_width = screen.get_width() // 2
half_width = screen.get_width()//2
image_height = screen.get_height()
render_text(screen,"Press R to return",(half_width,half_height),pygame.font.SysFont('Arial', 28),"white",half_width)


vic_track = []
render_text(screen, f"You {wl}!", (half_width // 1.1, half_height // 1.1), pygame.font.SysFont('Arial', 28),"white",half_width)
render_text(screen,"Press R to return",(half_width // 1.2,half_height),pygame.font.SysFont('Arial', 28),"white",half_width)

run = True
while run:
Expand All @@ -87,7 +110,7 @@ def change_screen_win_screen():

pygame.display.update()
pygame.display.flip()
# main_menu()


def render_text(surface, text, pos, font, color, max_width):
"""
Expand Down

0 comments on commit 2e2d51f

Please sign in to comment.