- Tested on: Lab Machine
- Build script: Ant
The_Frogger
| src
| ├── display
| │ └── Main.java
| │
| ├── element
| │
| └── interact
| ├── model
| ├── view
| └── controller
|
| resource
| ├── css
| ├── img
| └── music
|
| test
-
Use Simple Factory Pattern to expose the object creation logic to the actors. Method
getActor()
is created inActorFactory.java
to generate different actors, used inGameApp.java
to create an instance. -
Use MVC modern to keep the model away from the GUI implementation. FXML document is used for GUI design. Main process happens in model and use controller to handle events. For example,
ScoreBoard.java ScoreBoardController.java ScoreBoard.fxml
-
Use Singleton pattern to generate one(only one) ScoreBoard instance. So that players' information will be read uniformly by a singleton object.
In ScoreBoard.java
public static ScoreBoard getInstance() { if (instance == null) { instance = new ScoreBoard(); } return instance; }
In KeepScore.java
ScoreBoard a = ScoreBoard.getInstance();
Get and procedures are used to provide public access to private member variables. Besides. For instance,
static final double IMG_SIZE=40; static final double MOVEMENT;
The body of Animal.java is too long. So, I extracted death( ),insideBoundary( ), keepSpeed( ) from the big block and recall them in act( ).
For example, when count the number of ends that frogger have reached, I used static final double NUM_OF_END=5;
I extracted the code that used for scene switch to a new class SceneSwitch.java
and use method sceneJump()
to implement it.
When a player complete the game, system will record his score in score.txt
and compare his socre with histry player scores. If he can enter Top5 list, he will get the right to enter his name and his information will be written in sortedScore.txt
.
At the beginning of the game, each player has five lives. If they lose all the lives, they lose the game.
- Initially, player has the choice to choose
Easy Level
orNormal Level
. The normal level Hawaiian style, the frogger should avoid vehicles in the dessert and across the ocean by boat. By the way, there are angry sharks in sea, you can only skip them when they hide under water otherwise you will lose your life. Portal:
A portal will appear randomly on the map.Secret Level:
Player can only enter the hidden level when the forgger triggers the Portal. When player enters new level successful, he has another new five lives.
Player can choose to read the information about this game at the beginning of the game and then go back to index page.
Import custom fonts and stylesheet.
Verify that whether the file path is correct(Eg. EndTest.java, SceneSwitchTest.java)
Handle incorrect input situation (Eg. ScoreBoard.java, AnimalTest.java)