Giter Club home page Giter Club logo

super-mario-bros's Introduction

Super Mario Bros

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/

  • NOTE: The web build is lower quality and may contain some glitches

Compiling

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

Makefile (Recommended)

  1. Open the Makefile

  2. Replace the areas where you see ******SDL2 LOCATION****** with the direct location of the folder for the specified library

    • If you are using windows, in the LINKER_FLAGS section, add -lmingw32 before $(SDL2_LINKER_FLAGS)
  3. Run the Makefile build command, make

    • The MinGW compiler has a different command, mingw32-make

Command Line

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

How it Works

The Entities

  • 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:

      • Position Component
      • Texture Component
      • Moving Component
    • 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 Commands

  • Commands are used to perform actions that aren't focused on one entity. Commands are most commonly used in sequences, where multi-step processes are executed in order. Examples of this being used is the WarpCommand for warp-pipes and the VineCommand for climbing a vine.

The Levels

  • 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.

Special Thanks

People that have been a huge help in developing this project with their amazing knowledge and skills

Screenshots

Main Menu

Main Menu

Game

Game

Pause Screen

Pause Screen

Options

Options

Underwater

Underwater Level

Gameover

Game Over

super-mario-bros's People

Contributors

gold872 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.