zork2Class
Class DungeonFileSaving
java.lang.Object
|
+--zork2Class.DungeonFileSaving
- public class DungeonFileSaving
- extends java.lang.Object
This class permit the player to save his game, and load it an other day. The class build a
file like {namedungeon}_{namePlayer}.sz2. This file contains all the parameter
of the game which could change : example (The state of the door, the state of an ordeal...etc..).
The programm save only the room which are visited because the other room, can't be modified because the player
could not go there.
This is an example of a file which are Generate by this programm : essai.sz2
<!-- Backup Zork 2
Build by Zork2, used only on the game : Zork 2
Authors : BOYERE Fabien, DE VERDELHAN Michel
-->
<Z2SAVING> //the begin of the saving
Dungeon = "hantedDungeon" //this is the name of the original dungeon
<PLAYER> //this tag contain all the information about the player
Name = "Joueur1"
Strength = "68"
Dexterity = "100"
Intelligence = "89"
StartEnergy = "52" //His energy level when he start the game
LifeNumber = "3"
EnergyAt = "24" //His Energy Level when the game was saving
posY = "3"
posX = "3"
Score = "22090"
LastRoom = "north"
CurrentRoom = "center"
CurrentWeapon = "épée d'or"
Item = "trou" //an item in his inventory
Item = "feu"
Item = "épée d'or"
</PLAYER>
<ROOM> //a room which are visited
Name = "center"
DoorSouthOpen = "true"the state of the south door (Open or close)
DoorNorthOpen = "true"
DoorWestOpen = "true"
DoorEastOpen = "true"
item = "mur,2,1"//all the item and their position
item = "soupe,6,1"
item = "mur,2,2"
item = "pilier,6,3"
item = "puit,2,4"
item = "table1,3,4"
item = "table2,4,4"
item = "table,6,5"
OrdealActivate = "false"The state of the ordeal
</ROOM>
</Z2SAVING>
This file could be read by a class which name is DungeonFileLoading.
- Version:
- 1.0, 28/03/03
- Author:
- IUT de Vannes, Fabien BOYERE
Constructor Summary |
DungeonFileSaving(Game game,
java.lang.String nameSaving)
This is the constructor of DungeonFile Saving. |
Method Summary |
boolean |
writeDungeonFile()
This method is used to write the saving. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DungeonFileSaving
public DungeonFileSaving(Game game,
java.lang.String nameSaving)
- This is the constructor of DungeonFile Saving. It permit to construct a new saving
of a Zork2 play.
- Parameters:
game
- - The game which is saving.nameSaving
- - The name of the saving. It better if the name like {namedungeon}_{namePlayer}.sz2.
writeDungeonFile
public boolean writeDungeonFile()
- This method is used to write the saving.
- Returns:
- this method return true if the operation is complete. If the programm meet error
the method return false.