0
We want to make a kind of Menu that contains a tutorial of the game that will appear on the top of the stage at the beginning and when the player presses the help button, but we cannot make this texture appear through a function, the texture simply does not appear.
def main_menu():
while True:
screen.fill((0, 0, 0))
draw_text('main menu', font, (255, 255, 255), screen, 20, 20)
mx, my = pygame.mouse.get_pos()
button_1 = pygame.Rect(400, 50, 800, 200)
button_2 = pygame.Rect(450, 500, 720, 180)
if button_1.collidepoint((mx, my)):
if click:
game()
JanelaFase1()
pg.display.flip()
if button_2.collidepoint((mx, my)):
if click:
options()
def game():
running = True
while running:
screen.fill((0, 0, 0))
draw_text('game', font, (255, 255, 255), screen, 20, 20)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
running = False
screen.blit(BACKGROUND_FASE, (0, 0))
pygame.display.update()
mainClock.tick(60)
def JanelaFase1():
running = True
while running:
screen.blit(texto, (300, 100))
pygame.display.update()
mainClock.tick(60)