
Math and Logic in Games
50
Else
If (QUEST_OF_STONE_SWORD = COMPLETE)
Then (SHOW_TEXT “You found the Stone
Sword.”)
In this case, ACTIVE and COMPLETE are variables that are checked
by the code. If the variable is set to ACTIVE, then the rst message
appears, and when the sword is found, the variable is changed to
COMPLETE and the second message appears. e construct could be
extended to include many other variables, although in this case the
game code always uses whichever variable is currently set.
is is a simple example of how scripts work in a game. e
scripts can be relatively simple or quite complex, dep ...