Level Spec for "Jippy Snake 8":
Jippy Snake 8 uses the xml format to discribe the levels. So the Level files starts with:
and ends with:
Between you can define objects.
1. The object:
This object has following Syntax:
The following Strings are allowed for someType:
1. author
2. name
3. introText
4. startNewApples
5. funcNewApples
6. startApplesTillNew
7. funcApplesTillNew
8. neededApples
9. blind
10. time
What you can set for someContent depands on what you set for someType:
1. The name of the Level-Designer
2. The Name for the Level
3. A name of the text, that is shown, when the level is startet
4. A positive integer to set how many Apples have to been shown at satrt-up
5. A Function that calulcates how many apples have to be placed, when new apples have to been plced. (See more in the Functions-section)
6. A positive integer to set how many apples have to been eaten until the player gets new for the first time
7. A Function that calulates the value for the number that player has to eat, until new apples will be placed. (See more in the Functions-section)
8. A positive or zero integer to set how many apples have to been eaten to set the level as done
9. A boolean value to aktivate Blind-mode (false : no blindness; true : blindness)
10. Integer. The time (moves), that the player has, to eat neededApples. -1 means: Player has infinity time. Must be -1 or larger
If you mis to set one of theres options, following default Values will be used:
1. "UNKNOWN"
2. "NONAME"
3. "NULL"
3. 1
4. const
5. 1
6. const
7. 0
8. false
10. -1
These default values sets a classic snake game.
2. Functions
This section is for the funcNewApples ans funcApplesTillNew infos.
In the content ttribute you can type and function you want.
You may use following symbols within the function:
Variables: prev (Contains the previous value)
apples (Contains that number of apples that have been eaten)
Numbers: Any integer number
Operations: The basic operations ("+", "-", "*" and "/")
Examples:
1.
If you have this in your Level file an you play the level. The game will do this:
1. It places one apple (startNewApples=1)
2. When you eaten startApplesTillNew(=1) apples, the game calculates the next valu for startNewApples and startApplesTill new:
Both uses the function "prev+prev" for this.
func1 calulates prev+prev.
For the next value of startNewApples it sets prev to startNewApples(=1) and gets 1+1=2. So the next Value for startNewApples is 2
for startApplesTillNew is works the same way.
3. The game places startNewApples(=2) new apples.
4. if you have eaten startapplesTillNew(=2) the game goes to step 2.
and so on
In this Example you first eat 1 apple, then you get 2 new. You eat 2, you get 4. You eat 4, you get 8. ans so on.
2.
With this the game dows this:
1. Place startNewApples(=1) apples
2. If you have eaten startApplesTillNew(=1) apples the game makes this
2.1 it calculates the next value for startApplesTillNew and sets it
The uses Function for this is "prev". So the value of startApplesTillNew does not change.
2.2 it calculates the next value for startNewApples and sets it
The used function ist "prev+1". So the Value for startApplesNew will be increased by one.
3. The game jumos to step 1
In this example you get 1 apple. You eat 1, you get 2. You eat 1, you get 3.
Note: "you get N" means: N new apples will be places on the field. No apple will be removed with this
NOTES:
If the result of a function is negative: 0 will be used for the result.
The result of a division by 0 will be 0. (Also for internal calcuations!)
example: "prev+prev/(prev-prev)" will alwas return prev.
3. The object:
To discribe the level itself you can use the object.
It fills one Quad with the fiven texture. Use the following syntax für this object:
SX, SY, SZ means the startposition of the quad
EX, EY, EZ means the endposition f the quad
N means the texturenumber (See Texture-specs for details)
4. The object:
You can alos discribe one single cell of a level
Use the Syntax:
X, Y, Z means the position of the cell
N means the texturenumber of the cell (See Teture-specs)
Note:
--If one cell is discribes twice or more by or the cell gets the lastet given texture
--If one cell is not discribed, it gets Texture 0(Invisible block)
--Values for Z, SZ or EZ:
-1 Backgrund-layer
0-4 Game layers
5 Foregorund layer
----DEPRICATED---
6. The object:
You can set doors within a level. A Door has two states:
Open: Door hevaves lie a bridge
Closed: Door behaves lie the texture that has the door
Use the Syntax:
to place a door.
X,Y,Z means the positions of the door
N means the texture number of the door
NAME means any Name for the door
S meant the beginning state of the door. Possible are the values: open, closed
7. The object:
To open/close doors you can set buttons.
Each button triggers one door. It is also possible that two buttons triggers one door.
Each turn alls doors gets their beginning state. If one button is hoverd by snake the triggered door gets
the inverse State of ist beginning state.
Use the syntax:
To disrcibe buttons.
X, Y, Z means the position of the button
N means the texture of the button (should be a bridge)
NMAE means the driggered Door