Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- intro = True
- rect_x = 340
- rect_y = 130
- gamechoice = 0
- while intro:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- quit()
- backgroundimage = pygame.image.load('background.jpg')
- screen.blit(backgroundimage,(0,0))
- #-----------------------------------------------------------------
- # you ended here trying to make
- # a selection rectangle you need to make it hollow
- #-----------------------------------------------------------------
- #selection rectangle
- rect = pygame.image.load('rect.png')
- screen.blit(rect,(rect_x,rect_y))
- #Text size for title
- screenText = pygame.font.Font('freesansbold.ttf',60)
- #text size for selection
- screenText2 = pygame.font.Font('freesansbold.ttf',25)
- #Display Title "Pong"
- TextSurf, TextRect = text_objects("Pong", screenText)
- TextRect = ((360),(65))
- gameDisplay.blit(TextSurf, TextRect)
- #Display selection "Single Player"
- TextSurf2, TextRect2 = text_objects("Single Player", screenText2)
- TextRect2 = ((350),(135))
- gameDisplay.blit(TextSurf2, TextRect2)
- #Display selection "Two Player"
- TextSurf3, TextRect3 = text_objects("Two Player", screenText2)
- TextRect3 = ((370),(175))
- gameDisplay.blit(TextSurf3, TextRect3)
- if event.type == KEYDOWN:
- if event.key == K_UP:
- rect_y = 130
- elif event.key == K_DOWN:
- rect_y = 170
- if event.type == KEYDOWN:
- if event.key == K_SPACE:
- intro = False
- if rect_y == 130:
- gamechoice = 1
- if rect_y == 170:
- gamechoice = 2
- pygame.display.update()
- clock.tick(15)
Add Comment
Please, Sign In to add comment