Reference no: EM132891647
ICT221 Object-Oriented Programming - University of the Sunshine Coast
Tasks
A MazeRunner game with two components
Game Engine with Unit Tests
JavaFX GUI to play
Goal
To reach the Exit with more gold coins before losing stamina
Key features
10 x 10 2D grid game
The player starts at the Entrance and moves in 4 directions
A game has a difficulty d (default: 5)
12 initial stamina. Each move consumes 1 stamina.
Elements in the map
Entrance is at the bottom left and Exit is random
5 random gold coins. The number of gold coins at Exit is the game score.
d random traps: consume 1 gold coin to pass the trap
(10 - d) random apples: increases the stamina by 3
Requirements
Game Engine
strong encapsulation of the data fields within classes
private fields with getters/setters
correct implementation of association or composition relationships between classes
good use of inheritance/interface and subtype polymorphism
Use interface for different item types
good choice of data structures
How to represent the map and items
adherence to recommended Java coding style (naming conventions, code formatting etc.)
and concise elegant code with no duplicated code
follow correct JUnit naming conventions
thoroughly test all the Game Engine classes
GUI functionality
a playable and robust game
good use of JavaFX widgets, layout panes, and controls to build an elegant and functional user interface
4 arrow buttons for playing
Help button
Show current stamina & gold collected
appropriate use of bitmap images in the GUI
Background, icons for items & buttons, etc.
saving/loading of games states
Save & Load buttons
GUI code
good use of event-driven programming
Event handlers for buttons/arrow keys
good OOD of the GUI classes with strong encapsulation of the data fields within classes
good use of inheritance/interface and subtype polymorphism
E.g. each cell is a Pane?
adherence to recommended Java coding style (naming conventions, code formatting etc.)
concise elegant code with no duplicated code
and good use of exception handling to catch and report any I/O or game errors
Strategy
Design and implement the backend Engine first. Once the Engine can be played in a text version, starting creating the frontend GUI.
Engine is the real workhorse while the frontend GUI is a skin to allow users to play visually.
Clicking a button in the GUI actually 1) invokes a method of the Engine to update the game state, and 2) reload the GUI to show the latest game information.
At the backend, the Engine class would include the following fields:
A map which can be easily represented as a 2-d array.
A player object which records the details of the player, e.g. stamina, location, gold coins, etc.
The player's information is updated during the game play, eg. moveUp(), moveLeft().
Try to draw the UML diagrams for the class designs and then implement in Java
In the Engine, the map is a 2d array. There're different ways to model the array elements
Use different integer values to represent different types of cells, e.g. entrance, exit, apple, etc.
Create a Cell class to model one cell in the map. Add a field cellType to represent the types of cell. ? More flexible and extensible solution
There're different ways to create the Grid map in GUI, e.g.
Create a static 10*10 GridPane in SceneBuilder
Not recommended as it's not flexible
Create a GridPane without size in SceneBuilder, then in Controller.java, create/add each grid cell by looping through the 2d array of map
To use this solution, Cell class should extend Pane class to enable its addition to GridPane.
Attachment:- Object-Oriented Programming.rar