A recreation of the Super Mario Game from the Nintendo NES written in C++ using the SDL2 graphics library
MIT License
A recreation of the Super Mario Bros game from the Nintendo NES using C++ and the SDL2 Library
Demo Video: https://www.youtube.com/watch?v=2BYdCmH1EEY
Play it online! https://gold872.github.io/games/super_mario_bros/
The following libraries are required to compile and run this project
Once you have the zip files extracted and the dlls placed into the project directory, compile using one of the following methods
Open the Makefile
Replace the areas where you see ******SDL2 LOCATION****** with the direct location of the folder for the specified library
-lmingw32
before $(SDL2_LINKER_FLAGS)
Run the Makefile build command, make
mingw32-make
g++ -std=c++17 -static-libgcc -static-libstdc++ -mwindows -I"include" -I"<SDL2 Location>/include" -I"<SDL2_image Location>/include" -I"<SDL2_mixer Location>/include" -I"<SDL2_ttf Location>/include" src/*.cpp src/*/*.cpp -O1 -o "Super Mario Bros" res/super_mario_bros.res -L"<SDL2 Location>/lib" -L"<SDL2_image Location>/lib" -L"<SDL2_TTF Location>/lib" -L"<SDL2_Mixer Location>/lib" -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
Note: If you are on Windows and using MinGW32, you must add -lmingw32
before -lSDL2main
in the command
The bin directory contains a precompiled executable if you do not want to go through the installation and compiling process
The Entities in this game are creating using an Entity Component System
Instead of having one Entity class that every Entity inherits, an Entity is a class that has nothing, but you are able to attatch components to it. Such components include:
These Components get used by the Systems, where they find Entities with certain components, and update the Entities properly using the data from the Components.
Entities don't only serve the purpose of displaying a texture on the screen, some are used to add properties to Entities (For example, classifying an entity as the player with the PlayerComponent), and some are also used to schedule an action (this is most commonly used in the sound and score system)
The Levels were created with the help of a program called Tiled Map Editor
After creating the Map in the Tiled Editor, they are exported as a CSV file, and then get read by the Map class, and using the IDs from the Map, the Entities get created with their needed components.
People that have been a huge help in developing this project with their amazing knowledge and skills