Labyrinth

Python labyrint je 2D hra vyvinutá v prostředí PyCharm pomocí knihovny PyGame, ve které hráč prochází spletité bludiště až k cíli. Na své cestě čelí různým pastím a nepřátelům, kteří mu ubírají životy, a zároveň může objevovat léčivé lektvary obnovující jeho zdraví. Díky jednoduchému ovládání nabízí hra zábavnou kombinaci průzkumu a strategického boje, přičemž veškerá logika je implementována čistě v jazyce Python. Hra má také funkce jako Fog of War, hráč si může také zvolit velikost bludiště, případně jestli se budou objevovat pasti a nepřátelé. Celý postup si hráč může kdykoli uložit a následně načíst.

In this project, I did everything by myself, from the design all the way through to the programming.

Technologies used: PyCharm, Python, and PyGame

The game includes: game settings, enemies, traps, potions, a health bar, and Fog of War.

In the game settings, which appear as soon as the game starts, the player can choose the maze size (number of squares in the grid), whether to include traps or enemies in the maze, and whether to enable the Fog of War feature. They also receive instructions here on how to save and load their progress.

Game settings

Enemies in the Labyrinth represent a constant threat; their number dynamically scales with the size of the currently generated maze (larger map = more opponents). After each player move, all enemies randomly relocate to new coordinates within the passable corridors. Each encounter with an enemy reduces the player’s health, making the discovery of healing potions essential for survival. This random movement mechanic adds dynamism to the game and compels the player to plan each step carefully.

Enemies

Traps in the Labyrinth always number according to the dimensions of the generated map (larger maze = more traps). Unlike enemies, they remain fixed in their positions at all times, so the player cannot avoid them—stepping onto a tile with a trap immediately reduces the player’s health.

Pasti

The number of potions is determined by the size of the map, but there are always fewer potions than traps and enemies, making them harder to find. Unlike threats, each potion restores more health than the player can lose from stepping on traps or fighting enemies, so discovering them greatly increases the chance of survival. Potions remain in their fixed positions for the entire game, so once the player finds one, they can rely on its valuable health boost.

Lektvary

The player starts with a fully charged health bar, which represents their remaining life. Each encounter with an enemy or stepping onto a trap tile reduces the health bar by the corresponding amount, while discovered potions restore it by an even greater number of points. If the health bar drops to zero, the player dies and must restart the maze from the beginning.

Health bar

Funkce „Fog of War“ v Labyrintu zakrývá všechna políčka, která hráč "nevidí", a odkrývá pouze okolní buňky v bezprostřední blízkosti jeho pozice. Díky tomu nevidí celé uspořádání bludiště ani umístění pastí, nepřátel či lektvarů dopředu, ale až v momentě, kdy se k nim přiblíží. Tento omezený rozhled zvyšuje napětí a strategickou náročnost, protože hráč musí postupovat opatrně, riskovat průzkum neznámých prostor a spoléhat se na paměť a intuici místo jasného přehledu o mapě.

Fog of War