i0nics / super-mario-run

A fun side-scrolling platformer written in Java based on the original Super Mario Run game for iOS!
MIT License
5 stars 1 forks source link
2dplatformer game game-2d java mario nintendo platformer-game platformer2d

Contributors MIT License LinkedIn

Super Mario Run

A fun side-scrolling platformer written in Java based on the original Super Mario Run game for iOS!

Table of Contents

About The Project

This project is based on the original 2016 Super Mario Run mobile game developed by Nintendo for iOS. Super Mario Run is a side-scrolling platformer which consists of three levels. As Mario, Luigi, or Peach automatically run across the world, the player controls them by timing the jumps to kill enemies, dodge environmental obstacles, and collect coins to purchase new characters or power ups. This game also consists of a developer mode which was created with the intention of making it easier for devs to determine object placement coordinates while creating a new level.

Additional Documentation

Please visit Documentation.pdf for additional project documentation containing use cases, UML class diagram, interaction diagrams, algorithms, and key accomplishments.

New Enemy & Coin Tracker Update

Feature Overview

The new update introduces Koop Troopa which are turtle-like creatures. Similar to Goombas, the player needs to stomp on top of them to knock them out. A new Enemy interface is also implemented for a new merged Enemy class that handles the operation of both the original Goomba and the new Koopa Troopa. The speed of the enemies are also now dynamically implemented from a text file. Furthermore, every level now has a coin tracker on the top right which displays and dynamically updates the number of coins that are collected in the current level as the player progresses through it.

Pseudocode

A) The Enemies interface contains methods that are going to be used in the Enemy Class

interface Enemies
    updateBounds() Method that updates the location of invisible head and body GRectangles for collision detection
    Run() Method that initiates enemy and boundary movement and detects player collision
    getEnemySpeed() Method that returns current enemy's speed from text file
    getEnemyImage() Method that returns current enemy's image file

B) The Enemy class manages the location, movement, speed and collision detection of desired enemy (Goomba or Koopa Troopa)

class Enemy that implements the Enemies interface
    Enemy initialization constructor (main, levelPane, String enemyType, locationX, locationY)
        set program to main
        set level to levelPane
        set enemy type (Goomba or Koopa Troopa) to parameter enemyType
        set enemyImg to the image of enemy at location (locationX, locationY)
        initialize head to an invisible GRectangle object with appropriate height and width
        initialize body to an invisible GRectangle objectwith appropriate height and width
        set enemySpeed to the value extracted from text file returned by getEnemySpeed

    // Update head and body GRectangles to appropriate locations surrounding the enemy's head and body
    updateBounds()
        set location of head GRectangle around enemy's head
        set location of body GRectangle around enemy's body

    // Retrieve enemy speed from text file
    getEnemySpeed()
        open text file determined by enemy type
        set enemySpeed to first integer in text file and return

    // Return enemy image
    getEnemyImage() 
       return enemy image

    // Manage enemy movement and track enemy collision with player
    Run()
        if enemy is within 1000 pixels distance of the player
            move enemy at speed extracted from text file
            update enemy's collision boundaries

        else
            move enemy at default speed
            update enemy's collision boundaries

        if player has equipped star power up and player touches enemy
            kill enemy

        else if player collides with enemy's head
            play stomp sound
            kill enemy

        else if player collides with enemy's body
             kill player 

C) The Constructor and actionPerformed methods in the LevelPane class are now used to implement a dynamic coin tracker

LevelPane() 
    Initialize new coin counter GIF file at desired location in top-right of screen
    Initialize new coin counter label at desired location in top-right of screen and set it to current number of coins collected
    Set color of GLabel to white

ActionPerformed()
    check if character has collected coin and update current number of coins collected accordingly
    Update coin counter label to current number of coins collected

Steps to Check Out the New Features

Screenshots

Start Screen

Main Menu

World Tour

Level One

Level Two

Level Three

Shop

Characters

Power Ups

Guide

Minimum Requirements

CPU: Mediatek MT6582M Quad Core 1.6 GHz or equivalent
GPU: ARM Mali-400 or equivalent
RAM: 1 GB
Storage: 500 MB
Display: LCD Color Display
OS: Windows 10 version 1507/macOS 10.14 Mojave (Liberty)

Java SE 8

Getting Started

Import this project into Eclipse IDE and run the mainSMR.java file

Acknowledgements

License

Distributed under the MIT License.