Code Monkey home page Code Monkey logo

super-mario-bros's Introduction

Super Mario Bros

Made for educational porpuses. No game-engine, only C++ and SDL2.

I've used an ECS architecture taking cues from: https://github.com/redxdev/ECS

  • Author: Fernando Raviola
  • Twitter: @fernandoraviola

Contributions are welcomed!

Controls

  • AWSD to move
  • LSHIFT to sprint
  • E to enter the level editor

Build

I've only tested this on macOS Catalina but should work in Windows and Linux as well.

Prerequisites:

$ brew install cmake sdl2 sdl2_image sdl2_ttf sdl2_mixer 
$ make build run

# or

$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd ../bin/  
$ ./smb-

Webassembly (thanks @parwenaker!)

Either install emsdk and run

$ mkdir build
$ cd build
$ emcmake cmake ..
$ make

or build with Docker

$ docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emcmake cmake -S . -B build
$ docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk cmake --build build

Start a webserver in the bin folder

$ cd bin
$ python -m SimpleHTTPServer 8000
$ open http://localhost:8000/smb-.html

Screenshots

Game screenshot Loading screenshot Editor screenshot

Level editor

alt text

super-mario-bros's People

Contributors

feresr avatar parwen68 avatar

Stargazers

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

Watchers

 avatar  avatar

super-mario-bros's Issues

mario won't die

When mario dropping out of screen, mario is still alive and the scene can be running along.

Make the list (vector) of entities a contiguos array of objects

World::entities is a vector of pointers, those pointers could be scattered in memory. Iterating over them might result in poor usage of CPU caches.

I tried changing std::vector<Entity*> entities; to std::vector<Entity> entities; but other problems arose. (Namely some systems might keep a pointer to a specific entity, the pointer becomes a dangling pointer when adding/removing items to the vector invalidates them)

I think my own inexperience with CPP is showing here, I'll revisit this when I feel more comfortable with it

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.