This project is a 2D Pacman-style game with an added twist. In this game, the player controls a knight/warrior character navigating, aiming to consume all demons (represented by ghosts). The game includes special snacks that, when consumed, temporarily boost the player's speed.
-
game.h: This is the header file for the main Game class. It contains declarations of all functions and variables used in the game. This includes initialization functions for the game window, background, player, ghosts, and snacks, as well as functions for movement, collision detection, and rendering. -
game.cpp: This file contains the implementation of the Game class. It defines the game logic, including how the game window is created, how the player and ghosts are controlled, and how collisions are handled. The file also contains the game loop, which continuously updates the game state and renders the game to the screen.
- SFML (Simple and Fast Multimedia Library)
- A C++11 compatible compiler
- The player uses arrow keys to navigate the knight through the maze.
- The goal is to consume all ghosts (demons) in the window.
- Consuming a snack gives a temporary speed boost to the player.
- The game ends when the player consumes 25 ghosts.
The game is developed and tested in an environment with SFML installed.
- Speed Boost: Eating a snack increases the knight's speed for a short duration.
- End Game Condition: The game concludes successfully when the player consumes 25 ghosts.
To run this game, you need to have the SFML library installed on your computer. Follow these steps to compile and run the game:
- Clone the repository to your local machine.
- Compile the code using a C++ compiler. Make sure to link the SFML library. For example:
g++ src/*.cpp -Iinclude -I/usr/local/Cellar/sfml/2.6.1/include -L/usr/local/Cellar/sfml/2.6.1/lib -lsfml-graphics -lsfml-window -lsfml-system - to run the game:
./a.out
These commands are ran on a macbook laptop