2D GAME ENGINE
Game Objective:
The player controls a character and must navigate through various levels, collecting resources and overcoming obstacles. The goal is to gather a specific combination of materials, craft special items used for combat or restoring health, and find the key to advance to the next level.
Game Elements:
Game Board:
- Size:
- The game board is a 10x10 square grid.
Non-living Obstacles:
- Wall:
- Blocks the player's movement.
- Water:
- The player cannot pass through water tiles and must find a way around them.
- Fire:
- Fire tiles pose a threat to the player. Stepping on fire reduces the player’s health. Fire can be extinguished using water.
Living Obstacles:
- Ghost:
- Moves across the game board and poses a danger to the player.
Items:
- Metal Ore:
- Used to craft a sword.
- Water:
- Used to extinguish fire or to create a potion.
- Herb:
- A resource for crafting a potion.
- Sword:
- Used to defend against ghosts. It protects the player once upon contact with a ghost but does not kill the ghost. To craft a sword, the player needs 3 metal ores.
- Potion:
- Restores 1 health point. To craft a potion, the player needs water and a herb.
- Key:
- Unlocks doors leading to the next level.
Inventory:
The player can open the inventory by pressing the "I" key (short for "Inventory").
Crafting items:
New items are crafted in the inventory. Once the player has collected the necessary materials, they can open the inventory. The player selects the "+" option to start crafting. A recipe (e.g., for a sword) is displayed as an icon. The player drags the required resources into designated slots within the recipe. Once all necessary materials are placed, the player confirms the crafting process. The crafted item appears in the inventory upon completion.
Controls:
Movement: Use WASD keys to move up, left, down, and right.
Interacting with items: Items are collected automatically when
the player touches them. To interact further, the player must open
the inventory and select an item by clicking on it. Each item can
only be used once.
Saving & Loading:
Saving: The game is automatically saved at the end of each level.
Loading: The player resumes from the last saved position upon starting the game.
Technologies:
- Java:
- The game is implemented entirely in Java, including all core mechanics and logic. Object-oriented principles are used to structure the code and manage game entities.
- JavaFx:
- The user interface is developed using JavaFX. It handles rendering, user interactions, and visual components such as buttons, inventory management, and movement controls.
- JSON file:
- The game state is stored in JSON files, which contain all relevant data, including the positions of all game elements and the items in the player's inventory.
- Development tools:
- Intellij IDEA, GIMP