Guest User

Untitled

a guest
Jan 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. intro = True
  2. rect_x = 340
  3. rect_y = 130
  4. gamechoice = 0
  5.  
  6. while intro:
  7. for event in pygame.event.get():
  8. if event.type == pygame.QUIT:
  9. pygame.quit()
  10. quit()
  11. backgroundimage = pygame.image.load('background.jpg')
  12. screen.blit(backgroundimage,(0,0))
  13.  
  14. #-----------------------------------------------------------------
  15. # you ended here trying to make
  16. # a selection rectangle you need to make it hollow
  17. #-----------------------------------------------------------------
  18.  
  19.  
  20. #selection rectangle
  21. rect = pygame.image.load('rect.png')
  22. screen.blit(rect,(rect_x,rect_y))
  23.  
  24.  
  25. #Text size for title
  26. screenText = pygame.font.Font('freesansbold.ttf',60)
  27.  
  28. #text size for selection
  29. screenText2 = pygame.font.Font('freesansbold.ttf',25)
  30.  
  31. #Display Title "Pong"
  32. TextSurf, TextRect = text_objects("Pong", screenText)
  33. TextRect = ((360),(65))
  34. gameDisplay.blit(TextSurf, TextRect)
  35.  
  36. #Display selection "Single Player"
  37. TextSurf2, TextRect2 = text_objects("Single Player", screenText2)
  38. TextRect2 = ((350),(135))
  39. gameDisplay.blit(TextSurf2, TextRect2)
  40.  
  41. #Display selection "Two Player"
  42. TextSurf3, TextRect3 = text_objects("Two Player", screenText2)
  43. TextRect3 = ((370),(175))
  44. gameDisplay.blit(TextSurf3, TextRect3)
  45.  
  46. if event.type == KEYDOWN:
  47. if event.key == K_UP:
  48. rect_y = 130
  49. elif event.key == K_DOWN:
  50. rect_y = 170
  51.  
  52. if event.type == KEYDOWN:
  53. if event.key == K_SPACE:
  54. intro = False
  55.  
  56. if rect_y == 130:
  57. gamechoice = 1
  58.  
  59.  
  60. if rect_y == 170:
  61. gamechoice = 2
  62.  
  63. pygame.display.update()
  64. clock.tick(15)
Add Comment
Please, Sign In to add comment