## Programovanie počítačovýh hier
#### alebo herným vývojárom rýchlo a ľahko
miroslav.binas@tuke.sk / [**LSTME 2019**](http://www.lstme.sk/o-sustredeni.html)
## 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?
![Arkanoid Logo](images/arkanoid.logo.jpg)
Note:
* https://i.ytimg.com/vi/2bdFsD_0HXI/maxresdefault.jpg
[![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
```
.
├── invaders.py
├── sounds/
│ ├── beep.wav
│ └── jingle.wav
└── images/
├── background.png
├── invader.png
├── laser.png
└── player.png
```
## 2D Coordinate System
![2D Coordinate System](images/2d.coordinate.system.png)
![Actor](images/invader.png)
## Pygame Handles
![Pygame Handles](images/handles.png)
![Collisions](images/collisions.png)
Note:
* https://treadgaming.blogspot.com/2016/06/video-game-physics-tutorial-part-ii.html
## Links
* [projekt](balicek.zip) - výsledný projekt
* [assets](game.assets.zip) - stolen from [Kenney.nl](https://kenney.nl)
* [Pygame Zero homepage](https://pygame-zero.readthedocs.io/) ([sk](https://pgzero-slovak.readthedocs.io/sk/latest/index.html))
* [Wireframe](https://wireframe.raspberrypi.org/) and [MagPi](https://www.raspberrypi.org/magpi/) Magazines
* [Mission Python](https://nostarch.com/missionpython) ([YouTube Video](https://www.youtube.com/watch?time_continue=2&v=_2aglIeW1kQ))
* [Tvorba počítačových hier s Pygame Zero](https://legacy.gitbook.com/book/bletvaska/tvorba-pocitacovych-hier-s-pygame-zero/details) - poznámky ku prednáške
* [PyWeek](https://pyweek.org/) - Python Game Programming Challenge
[![Humble Bundle](images/humble.bundle.png)](https://www.humblebundle.com/books/python-programming-no-starch-books?hmb_source=humble_home&hmb_medium=product_tile&hmb_campaign=mosaic_section_2_layout_index_1_layout_type_threes_tile_index_2_c_pythonprogrammingnostarch_bookbundle)
![qr code](https://api.qrserver.com/v1/create-qr-code/?data=http://bit.ly/2NuC5JC&size=300x300)
(**http://bit.ly/2NuC5JC**)