## 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 2023**](http://kpi.pages.kpi.fei.tuke.sk/hands-off/)
## Hráte sa počítačové hry?
![Saboteur](https://assets.nintendo.com/image/upload/c_fill,w_1200/q_auto:best/f_auto/dpr_2.0/ncom/software/switch/70010000012302/6b14a81d7a852afd6b2640a68034290c0971146e14d0b005e6eb69f4ed4aca4a)
## Naprogramovali ste si vlastnú počítačovú hru?
![Arkanoid Logo](images/logo-arkanoid.jpg)
Note:
* https://i.ytimg.com/vi/2bdFsD_0HXI/maxresdefault.jpg
[![Kenney.nl](images/logo-kenney.png)](https://kenney.nl/)
[![Arcade Logo](images/logo-arcade.png)](https://arcade.academy/)
[![Pyglet Logo](images/logo-pyglet.png)](https://pyglet.org/)
[https://pyglet.org/](https://pyglet.org/)
### Easy to use Python library for creating 2D arcade games.
## Installation
```
$ pip install arcade
```
## 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)
## Sprite Fields and Methods
* `sprite.center_x`, `sprite.center_y`
* `sprite.position`
* `sprite.width`, `sprite.height`
* `sprite.draw()`
## Sprite 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](arkanoid.zip) - výsledný projekt
* [assets](https://kenney.nl/assets/puzzle-pack) - stolen from [Kenney.nl](https://kenney.nl)
* [Arcade Homepage](https://arcade.academy/)
* [Pyglet Homepage](https://pyglet.org/)
* [PyWeek](https://pyweek.org/) - Python Game Programming Challenge
* [Multimediální knihovna Pyglet](https://mojefedora.cz/multimedialni-knihovna-pyglet/)
## Tasks #01: The Bricks
* Every brick has different color.
* Different color has different points.
* Different color has different power.
## Tasks #02: Powerups
* powerup is falling from brick
* sticky paddle
* bigger/shorter size of paddle
* speed up/down
* multi balls
* no walls on left and right
## Tasks #03: The Levels
* Different shape of bricks (triangles, smile, letter, ...)
* Different shape for different levels.
* Levels in file.
## Tasks #04: Effects
* [Parallax background](https://images.squarespace-cdn.com/content/v1/551a19f8e4b0e8322a93850a/1574024073167-PRLTM8P9IEOI4Q6EZQYO/Desert.gif)
* bouncing the ball
* breaking the brick
* brick has power
* hit/break effect
## Tasks #05: 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/3M3KUaL&size=300x300)
(**https://bit.ly/3M3KUaL**)