/increment-game

a thing for a final

Primary LanguageJavaMIT LicenseMIT

Increment

A screenshot of the main menu

Description

A Java game I wrote for a compsci project. Generate credits forever.

Implemented Concepts

For a quick four, look at GameState.java, buildings/machines/Machine.java and buildings/machines/LargeMachine.java.

Inheritance

  • SmallMachine and LargeMachine both extend Machine.

Abstract classes

  • The Machine class is an abstract class extended by SmallMachine and LargeMachine.

Interfaces

  • The Upgradable interface is implemented by LargeMachine.

File I/O

  • A JSON representation of the game's state is saved to a json file of the user's choosing.
  • If a save file exists, the user can choose to load it and instantiate a new GameState using that file.

Exception Handling for User Input

  • If a user chooses a save file that does not exist, an exception will be caught and a dialog will be shown prompting them to try again.
  • If a user inputs invalid characters in their "save game" prompt, they will be asked to try again. (Technically handled by the library.)

Override toString()

  • The GameState.toString() method overrides the Object.toString() method.

Overloading

  • Both Machine child classes have overloaded constructors.

Requirements

Usage

Jarfile

Download the jarfile from the Releases page, then use the java binary (or javaw if you're on Windows).

java -jar increment-game-VERSION.jar

Building

mvn clean
mvn package
java -jar target/increment-game-0.0.1.jar

The source also comes with a shell script, which builds the package and launches it in a CRT emulator for fun.

Contributing

dont :|