This project is an implementation of Nintendo Mario game using SDL2, as a part of Advance Programming course at University of Tehran.
sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-image-dev
This game is a simple part of mario game(only world 1-1), so there is no need to use any game engine, I've implemented whole game from scratch using C++.
Main game's structure is implemented in Core class which contains all game engine functionality. Game loop, rendering, input handling and ... are all handled in this class.
Game Map loads from a simple 'txt' file which is a grid of characters that each one represents an object. This structure makes everything much harder, because for example, a small 'pipe' in game consists of 4 blocks that each one is stored in memory and considered in physics engine. In my opinion, this is not an optimal way to create game objects(anyway this has been noted in project description) either for checking physics or from memory perspective. By the way this was a hobby project, and maybe I will change game structure later.
WIP
As mentioned above all objects are created from multiple blocks that are loaded from 'map.txt'.
- Object Types
Type | Image |
---|---|
BLOCK | |
BRICK | |
GROUND | |
FIRE_CONTAINER | |
HEALTH_CONTAINER | |
COIN_CONTAINER | |
PIPE | |
FLAG | |
GOOMBA | |
KOOPA | |
PLAYER | |
G_COIN | |
G_MUSHROOM | |
G_FLOWER |
- Object's variables
All objects are inherited from 'Object' class. This class consists related functions and variables, e.g
Variable | Usage |
---|---|
pos | Current Object position |
size | object size |
image | Image path for rendering |
type | Object's type (GROUND, GOOMBA, KOOPA, CLOUD, etc.) |
startAnimation | Is used for starting animation. (COIN, MUSHROOM, LEVELUP, etc.) |
Debug visual tools :)