Giter Site home page Giter Site logo

i0nics / super-mario-run Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 319.9 MB

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

License: MIT License

Java 100.00%
mario nintendo game platformer-game platformer2d 2dplatformer java game-2d

super-mario-run's Introduction

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

  • Start Game
  • Click on Tour
  • Click on any level that is unlocked
  • Koopa Troopas now visible on selected level as you play through
  • Coin Tracker on top-right of screen is present and dynamically updated as you collect coins

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.

super-mario-run's People

Contributors

drdreyno avatar hungle546 avatar i0nics avatar onzfonz avatar pacifickevintian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hungle546

super-mario-run's Issues

Bonus Treasure Chest Level after Level 3 Completion

The bonus treasure chest level is basically a level in which the player needs to choose one chest from three different chests that may or may not have a power-up in it. This level is only unlocked after the player completes the main three levels. The bonus level locks again after the player chooses a chest and then unlocks again after the player goes through the same three levels.

In order to implement this, a new BonusLevelPane class needs to be created with methods such as Run() which is responsible for calling on other methods. Some other methods that need to be implemented include chestRandomization() which randomly places a random power-up (star or mushroom) inside one of the chests. The various pause, resume, and music methods also need to be implemented. A hasPlayerChosenChest() method needs to be implemented to detect which chest the player has chosen and display whether the player won anything. In the TourPane, a new checkBonusLockStatus() method needs to be written that unlocks the bonus level once the player goes through all three main levels and locks the bonus level when the bonus level is cleared.

New Enemy: Koopa Troopa and Coin Tracker

Koopa Troopas are turtle-like creatures. Similar to Goombas, the player needs to stomp on top of them to knock them out.

In order to implement more enemies, a new Enemy interface will be added that contain common functions such as Run() and checkPowerUp()

How Koopa Troopa Will Be Implemented:

A new Koopa Troopa class that implements Enemy needs to be created with a Run() method which primarily will move the Paratroopa's GImage left and right in air. An updateBounds() method will also be added so that two separate invisible GRectangles that surround the head and body are utilized to detect whether the player defeated the enemy or vice versa(). A checkPowerUp method will adjust the enemy's response according to the player's active power-up.

The existing Goomba class will also be updated so that it now implements the Enemy interface.

The speed of both enemies will also be dynamically obtained from a text file.

Coin tracker on top right will now track coins as player collects them

Power-Ups Functionality

The two power-ups in Super Mario Run (mushroom and star) are currently strictly visual and do not perform the functions that they are intend to perform which are namely, getting another life if the player hits a Goomba (enemy) and becoming invincible for a short period of time respectively. Another issue that occurs is that the limited time star power-up is never unequipped in a future level after players have already used it up. As a result, players are able to keep the star power-up forever which is not very intuitive. Lastly, the star music does not stop if the player pauses, quits, or loses the game and sometimes plays over the existing game music.

How These Changes/Fixes Can Be Implemented:

  1. Mushroom Power-Up: In order to get this power-up working, the Run() method in the Goomba class needs to be modified such that if the player is equipped with the mushroom power-up, the player does not die and shrinks back to normal size (resetMushroomPurchased() method in playerProgressneeds to be called here). This indicates that if they player gets defeated by an enemy a second time, the player dies.

  2. Star Power-Up: Similiar to the changes that need to be implemented for Mushroom Power-Up, the Run() method in the Goomba class needs to be modified such that if the player is equipped with the star power-up, the Goomba disappears upon any sort of contact from the side. The isGameOver method also needs to be modified accordingly so that it "unequips" the star power-up by calling the resetStarPurchased() method in the playerProgress class.

  3. Music: The overlapping star music can be fixed by adding conditional statements in actionPerformed(), isGameOver(), and Pause() methods that check for the player's current power-up state and adjust the music coherently

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.