This is a final project in the course of Cpp_Nano_Project provided by Udacity. A simple Game is developed in Cpp with SDL2 Module.
- cmake >= 3.7
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- SDL2 >= 2.0
- All installation instructions can be found here
Note that for Linux, an
apt
orapt-get
installation is preferred to building from source. - gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make a build directory in the top level directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./Kong_Maze
.
The game loop has three Main components: Renderer, Controller, and Game.
- Game: This Game's Engine. It handles the game loop and store objects( Banana, Kong, Maze_map) used in this game.
- Renderer: Since in this project, I rendered lots of images in the program, here I created an Texture vector to store textures copy from surface. In this way these image will be loaded on GPU Memory which speed up the time for rendering. The delete function of renderer ensure that those memory are freed safely.
- Controller: This handle every inputs from users, including Collision detection, Move Kong, Goal Reached, and End game selection.
- Entity: This class is designed as a basic class of every items in the game (banana,kong). It includes the function of coordinate of object, and also the getter and setter.
- MovableEntity: It is derived from Entity class. This includes how the movable object handles moving events.
- Kong: Dervied from MovableEntity class. It also owns the memvers of reset opsition and reset function for Restarting Games.
- Banana: Derived from Entity class.
- A README with instructions is included with the project
- The README indicates which project is chosen.
- The README includes information about each rubric point addressed.
- The submission must compile and run.
- The project demonstrates an understanding of C++ functions and control structures.
- The project reads data from a file and process the data, or the program writes data to a file.
- The project accepts user input and processes the input.
- The project uses Object Oriented Programming techniques.
- Classes use appropriate access specifiers for class members.
- Class constructors utilize member initialization lists.
- Classes abstract implementation details from their interfaces.
- Classes encapsulate behavior.
- Classes follow an appropriate inheritance hierarchy.
- Overloaded functions allow the same function to operate on different parameters.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.