SHOW:
|
|
- or go back to the newest paste.
| 1 | def Instructions(): | |
| 2 | ||
| 3 | # declare only once | |
| 4 | paragraph = """Your are the last surviving rhino. Your horn | |
| 5 | is worth millions! Right now you are trapped in a zoo and | |
| 6 | waiting to be slaughtered for your horn. But you can't give | |
| 7 | up! Escape from the tribesmen and zoo security so you can | |
| 8 | enjoy your life as a free being once again""" | |
| 9 | ||
| 10 | # load only once | |
| 11 | image = pygame.image.load("background0.jpg").convert()
| |
| 12 | ||
| 13 | # create only once | |
| 14 | InstructionFont = pygame.font.SysFont("elephant",15)
| |
| 15 | ||
| 16 | # get only once | |
| 17 | TextSurf, TextRect = text_objects(paragraph, InstructionFont) | |
| 18 | ||
| 19 | # set only once | |
| 20 | #TextRect.center = ((screen_width/2),(screen_height/2)) | |
| 21 | TextRect.center = screen.center | |
| 22 | ||
| 23 | # create button only once | |
| 24 | button = Buttons("BACK",100,500,120,50,TURQUOISE,DARK_TURQUOISE,"back")
| |
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | # blit only once | |
| 29 | screen.blit(image, (0,0)) | |
| 30 | ||
| 31 | # blit only once | |
| 32 | screen.blit(TextSurf, TextRect) | |
| 33 | ||
| 34 | # draw only once | |
| 35 | button.draw() | |
| 36 | ||
| 37 | - | # blit 15 times per second (15 FPS) |
| 37 | + | # update only once |
| 38 | - | screen.blit(image, (0,0)) |
| 38 | + | pygame.display.update() |
| 39 | ||
| 40 | - | # blit 15 times per second (15 FPS) |
| 40 | + | |
| 41 | - | screen.blit(TextSurf, TextRect) |
| 41 | + | |
| 42 | # repeat thousands times in one second. | |
| 43 | - | # draw 15 times per second (15 FPS) |
| 43 | + | |
| 44 | - | button.draw() |
| 44 | + | |
| 45 | # check events 15 times per second (15 FPS) | |
| 46 | - | # update screen 15 times per second (15 FPS) |
| 46 | + | |
| 47 | - | pygame.display.update() |
| 47 | + | |
| 48 | pygame.quit() | |
| 49 | quit() | |
| 50 | ||
| 51 | clock.tick(15) # <- slow down to 15 FPS |