## Výučba programovania tvorbou počítačových hier [Miroslav "mirek" Biňas](https://bletvaska.github.io) / [**IT Burza 2023**](https://itburza.gvpt.sk/)
## 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?
![Flappy Bird](images/flappy.gif)
![Game Analysis](images/analysis.png) Note: * https://www.researchgate.net/publication/324066514_Playing_Flappy_Bird_with_Deep_Reinforcement_Learning
[![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._
## Inštalácia ``` $ pip install arcade ```
## Robíme okno ```python import arcade class Flappy(arcade.Window): def __init__(self): super().__init__() game = Flappy() arcade.run() ```
## [Štruktúra projektu](resources/flappy-skelet.zip) ``` . ├── assets │ ├── images │ │ ├── background.png │ │ ├── flappy.png │ │ └── pipe.png │ └── sounds │ ├── die.wav │ ├── hit.wav │ ├── point.wav │ └── wing.wav └── game.py ```
## Upozornenie! (no best practices provided)
![Game Loop](images/game-loop-simple.png) Note: * http://gameprogrammingpatterns.com/images/game-loop-simple.png
## 2D Súradnicový sys. ![2D Coordinate System](images/2d.coordinate.system.png)
![Actor](images/invader.png)
## Kola, Fanta, Sprite! * `sprite.center_x`, `sprite.center_y` * `sprite.position` * `sprite.width`, `sprite.height` * `sprite.draw()`
## Sprite Handles ![Pygame Handles](images/handles.png)
## Detekcia kolízií
![Collisions](images/collisions.png) Note: * https://treadgaming.blogspot.com/2016/06/video-game-physics-tutorial-part-ii.html
## Refaktoring ?!
### Pygame Zero vs Arcade
[![Namakany den](images/namakany.den.png)](http://www.namakanyden.sk) [www.namakanyden.sk](http://www.namakanyden.sk)
![qr code](https://api.qrserver.com/v1/create-qr-code/?data=https://bit.ly/46MaJ7g&size=300x300) (**https://bit.ly/46MaJ7g**)