AE2DMSCW-20126518
(word counts: 500 number of figures: 3)
[TOC]
Refactoring
1. OO design pattern
1.1 Factory Pattern
1.1.1 event
I applied factory design pattern for game events.
One eventHandleInterface.java
interface, one eventFactory.java
factory and 9 entities: closeGame, loadGame, resetLevel, saveGame, showAbout, showVictoryMessage, toggleDebug, toggleMusic and undo
1.1.2 music
I applied factory pattern for two kinds of music: background music and bomb music.
One Music.java
interface, one MusicFactory.java
factory and 2 entities: backgroundMusic and bombMusic.
1.1.3 engine
I applied factory pattern to move functions:
One abstract class Engine.java
, one factory engineFactory.java
and three entities: moveEngine, moveRedEngine and removeObject
2. GUI design pattern
I applied MVC for GUI design pattern.
2.1 V - Version
2.1.1 In InfoScreen.fxml view:
2.1.2 In StartScreen.fxml view:
2.1.3 In TouristMode.fxml view:
2.2 C - Controller
3. Refactoring methodologies
3.1 Corrective Maintenance -finding and fixing errors
3.1.1 complete toggle music function
I use an integer variable toggleMusicTimes
to count the click times.
3.1.2 complete undo function
I use an ArrayList<String>
to store all current levels and if user choose undo, remove the last element and assign the newly last element value to current level then reload game grid.
3.1.3 complete reset level function
I use the ArrayList<String>
created in undo
3.1.4 complete save game function
I write the levels including current level and the remaining to a new .skb
file.
3.1.5 correct codes
I corrected some codes for passing game levels.
3.1.6 remove unused codes
3.2 Dividing all classes into packages
I divided whole program codes into four big packages: controller, entity, enums and util.
3.3 using encapsulation
I made some fields to be private in a package.
3.4 make classes have single responsibility
Addition
high score
1. A Top5 high scores dialog after each game level (5 minimum moves counts), and Top1 if there are less than 5 playing times.
start screen
2. A start screen with background and two button: Start, Info.
information screen
3. A screen shows how to play this game.
transfer door
4. Keepers can be transfered from one door to another side.
ice floor
5. Keepers cannot stand on the ice floor.
double mode
6. Provide red and blue two keepers.
bomb with sound
7. Keepers can use bomb to blow up any object in four directions (up, down, right, left)
shortcut key
8. all functions at menu bar have their own corresponding shortcut key.
add a new game level
9. LevelName: Add a new Level ~ as the final game level
add UI
10. add pictures for game objects
Maven
11. add A ae2dms-cw-20126518-1.0-SNAPSHOT.jar
package used to run program directly.