<style> .reveal { font-size: 20px; } .reveal div.para { text-align: left; } .reveal ul { display: block; } .reveal ol { display: block; } img[alt=drawing] { width: 200px; } </style> # COMP1010 ## 8 PyGame --- # PyGame (and Game Concepts) ## Demo Summary | # | Description | Topics | |---|---|---| | 1-0 | Display Frankie on the screen | | 1-1 | Fullscreen mode | | 2 | Increase Frankie's size and change location | | 3 | Control Frankie's location using the arrow keys | Game Loop introduced<br>Scanning for Inputs introduced | | 4 | Make Frankie unable to fall off the screen | --- ## Demo Summary | # | Description | Topics | |---|---|---| | 5 | Put other walls up so Frankie has to walk around them | | 6 | Have Frankie change or walls change without user input (introduction to the clock) | Clock introduced | | 7-0 | Flappy Frankie introduction. Moving up and down based on space bar. | Game explained.<br>State Machine introduced | | 7-1 | Draw pipes. | | 7-2 | Many pipes. | | 7-3 | Pipes that move up and down. | | 7-4 | End of game based on collision with pipes. | --- ## Game Loop (animation) (demo 3 onwards) Draw, update, repeat. ## Scanning for inputs (demo 3 onwards) --- ## Clock (demo 6 onwards) clock.tick(frames) -- maximum number of frames per second. A low number your game will run slower, a high number your game will run fast. --- ## Flappy Frankie (demo 7 onwards) Basically making this game: https://flappybird.io/ ## State Machine (demo 7 onwards) In our example: Start: Paused Frankie, at the left of the screen, in the centre, ready to go. Pressing 'Space' moves us to the 'Playing' state. Playing: The pipes are moving, and when we press 'Space' it changes Frankie's acceleration. When we collide with pipes, we move into the 'Dead' state. Dead: Everything is still. The user gets to see how they died. Pressing 'Space' moves us back to the 'Start' state (resets the screen and waits for the user to press 'Space' to indicate they're ready to play again.) --- # Feedback ## Lecture: 8 PyGame [https://forms.gle/Uod5Jpr7AJ2z7cHLA](https://forms.gle/Uod5Jpr7AJ2z7cHLA) ![](https://i.imgur.com/0L50D4L.png)
{"metaMigratedAt":"2023-06-16T13:36:48.380Z","metaMigratedFrom":"YAML","title":"8 PyGame","breaks":true,"slideOptions":"{\"transition\":\"slide\"}","contributors":"[{\"id\":\"969c3c3d-0ef4-4f08-b22a-2f2b8951224b\",\"add\":1820,\"del\":365}]"}
    218 views