Skip to content

Create simple games with different platforms like iOS, Windows(java, delphi), Androdd(java, delphiXE).

License

Notifications You must be signed in to change notification settings

JimmyCheng/pushbox-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PUSH BOX

This is a Java version of the push box game. The intention of this game is to demonstrate the Java Swing desgin and MVC(model-view-controller) concept.


Author Jimmy
E-mail chengnianhua@gmail.com

Table Content

How To Play

The game is simple, use key "up", "left", "right", "down" to move the little man around. Use key "u" to undo a step. e.g. for the task 1, it is displayed:

Task1

The target is to make sure all the balls are covered by the box.

click the menu "Game" and select "Jump to Task", input the task ID from 1 to 100, e.g. input 33 then the task 33 is displayed:

Task33

How To Install

Clone the git respository use git clone and import the project in eclipse or intelij.

Design Highlight

The game is controlled by a matrix:

grid = new Cell[14][16];  //14 rows and 16 columns.

Each cell is an object with current status:

public class Cell {
    boolean black;
    boolean wall;
    boolean floor;
    boolean box;
    boolean ball;
    boolean spirit;
    int action;

    public Cell() {
        black = false;
        wall = false;
        floor = false;
        box = false;
        ball = false;
        spirit = false;
        action = NONE;
    }
}

In terms of the MVC design pattern, there the grid is the Model, the canvas is the view, the keyUp/Down event is the controller.

Other Implementations

Delphi Version

React Version

About

Create simple games with different platforms like iOS, Windows(java, delphi), Androdd(java, delphiXE).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages