Giter VIP home page Giter VIP logo

super-mario's Introduction

Python terminal Super Mario

========================================================
By Meher Shashwat Nigam

Introduction

This is a terminal based implementation that tries to simulate the classic Super Mario
Written in python3 without using pygame and curses.
Only colorama has been used to bring in colours.
The game has been tested only on Linux based operating systems, may not work on Windows.
Sounds have been added.

Prerequisites

  • First, install all the requirements
    • pip install -r requirements.txt
  • Running the game using python3
    • python3 game.py

GamePlay

Select the level you want to play by entering 1, 2 or 3 when prompted.
Mario has 3 lives. Make sure they count. Higher levels have :

  • Higher gravity
  • More enemies
  • Faster enemy movement
  • More coins ;)
Controls

You can move mario around using the following controls(make sure CAPS_LOCK is off):

  • d or right arrow to move right
  • a or left arrow to move left
  • w or up arrow or Space_bar key to jump
  • q to quit the game

Mario can collect coins as it moves --- 200 points

Mario can kill enemies by jumping over them. Enemies reduce lives by one if they hit mario from the side; but also die in the process --- 500 points

A base score is generated according to the maximum distance traveled in the game.

Mario doesn't know how to swim! Mario dies instantly after it falls into the pit.

Code Structure

The game has been written keeping in mind OOP principles.
The application demonstrates inheritance, encapsulation and polymorphism.

  • There are three major classes: Scene , Person and Obstacle
  • Mario and Enemy are derived classes of the Person class defined in people.py
  • Each obstacle/item (Walls,Pits,Clouds,Grass,Coins) inherits from the Obstacle class in obstacles.py
  • The Scene class holds the full map and all object matrices are blitted into its matrix defined in scene.py
  • The config.py file holds the constant values and variables used throughout the game, in one place
  • Game.py holds the main game engine, and has all object initializations.
  • scene_gen.py makes the basic scene by blitting walls, pits, grass and clouds onto the scene
  • gamefunctions.py has all necessary gamefunctions like checking object clashes and blitting one matrix over the other after updating
  • input.py defines how character input is taken at runtime
  • Code is PEP8 compliant

super-mario's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

peterprescott

super-mario's Issues

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.