## Programovanie počítačových hier #### alebo nie príliš stručný úvod do programovania v jazyku Python [Miroslav "mirek" Biňas](https://bletvaska.github.io) / [**Hands Off 2022**](http://kpi.pages.kpi.fei.tuke.sk/hands-off/)
## Hráte sa počítačové hry?
![Assassin's Creed](images/assassins.creed.jpg)
![TIS 100](images/tis.100.jpg)
## Naprogramovali ste si vlastnú počítačovú hru?
[![Kenney.nl](images/kenney-promo.png)](https://kenney.nl/)
[![Pygame logo](images/logo-pygame.png)](https://www.pygame.org/news)
[![SDL logo](images/logo-sdl.png)](https://www.libsdl.org/) Since 1998
![Steam logo](images/logo-steam.jpg)
### Pygame Zero is for creating games without boilerplate.
Note: * https://www.raspberrypi.org/magpi/wp-content/uploads/2015/06/35_PygameZero.jpg
## Installation * Raspberry Pi - builtin * `sudo dnf install pgzero mu` * `pip install pgzero mu-editor`
## Warning! (no best practices provided)
![Game Loop](images/game-loop-simple.png) Note: * http://gameprogrammingpatterns.com/images/game-loop-simple.png
## Project Structure ``` . ├── game.py ├── sounds/ │ ├── hit.01.wav │ └── hit.02.wav └── images/ ├── background.png ├── ball.png ├── brick.purple.png └── paddle.png ```
## 2D Coordinate System ![2D Coordinate System](images/2d.coordinate.system.png)
![Actor](images/invader.png)
## Actor Fields and Methods * `actor.x`, `actor.y`, `actor.pos` * `actor.image` * `actor.width`, `actor.height` * `actor.draw()`
## Pygame Handles ![Pygame Handles](images/handles.png)
## Collisioin Detection
![Collisions](images/collisions.png) Note: * https://treadgaming.blogspot.com/2016/06/video-game-physics-tutorial-part-ii.html
## Hands Off!
## What's Next?
## Tasks #01: The Bricks * Every brick has different color. * Different color has different points. * Different color has different power.
## Tasks #02: The Levels * Different shape of bricks (triangles, smile, letter, ...) * Different shape for different levels. * Levels in file.
## Tasks #03: Effects * [Parallax background](https://images.squarespace-cdn.com/content/v1/551a19f8e4b0e8322a93850a/1574024073167-PRLTM8P9IEOI4Q6EZQYO/Desert.gif) * bouncing the ball
## Tasks #04: Misc * Game Over and Well Done as images * bonus objects falling from bricks
![qr code](https://api.qrserver.com/v1/create-qr-code/?data=https://bit.ly/3s8mBxS&size=300x300) (**https://bit.ly/3s8mBxS**)