Skip to content

Phoenix-flame/Mario

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mario

Readme Card

This project is an implementation of Nintendo Mario game using SDL2, as a part of Advance Programming course at University of Tehran.

alt text

Requirement

sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-image-dev

Game Structure

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.

Physics

WIP

Objects

As mentioned above all objects are created from multiple blocks that are loaded from 'map.txt'.

  • Object Types
Type Image
BLOCK alt text
BRICK alt text
GROUND alt text
FIRE_CONTAINER alt text
HEALTH_CONTAINER alt text
COIN_CONTAINER alt text
PIPE alt text alt text alt text alt text
FLAG alt text alt text
GOOMBA alt text alt text alt text
KOOPA alt text alt text alt text alt text alt text
PLAYER alt text alt text alt text
G_COIN alt text
G_MUSHROOM alt text alt text
G_FLOWER alt text
  • 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.)

Graphic

Other

Debug visual tools :)

alt text

Releases

No releases published

Packages

No packages published