home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 12: Textmags & Docs
/
nf_archive_12.iso
/
MAGS
/
TEXTMAGS
/
3RD_DIM
/
3RDDM18.MSA
/
ROUTINES
/
SWITCH.TXT
< prev
Wrap
Text File
|
2004-06-27
|
4KB
|
176 lines
THE THIRD DIMENSION
Pick the correct switch
-----------------------
Switch Puzzle by John Clarke.
This puzzle is from a game that I am currently writing called "The Escape".
In this puzzle there are 6 switches on the wall and two force fields at each
end of the corridor. You have to select one of the switches in order to
deactivate one of the force fields enabling you to go on further. If you
select the wrong switch a laser cannon will appear in the centre of the
room and will start shooting at you.
Map
===
-------------------------------------------
: | 1 2 3 4 5 6 | :
: | LC | :
: | | :
-------------------------------------------
Key
---
1-6 : Switches
| : Force Field
LC : Laser Cannon
Sounds simple doesn't it. Well just to make it trickier I have written
the code in such a way that the computer will decide which switch will
deactivate the force field when you start the game.
Once the corridor was created I created an initial condition. The initial
condition makes both force fields fadebounce, sets all variable used for
this puzzle to 0 and then selects which switch will deactivate the force
field. The laser cannon is made invisible and is only made visible when
the wrong switch is selected.
Variables Used
--------------
V30 : To store random number (0,1,2,3,4 or 5).
V31 - V36 : To identify which of the switches will deactivate the force
field.
When the computer has selected which switch will deactivate the force field
it sets the appropriate variable to 1.
Switch Number | Value of Variable V30 | Variable to set to 1
---------------+-----------------------+---------------------
1 | 0 | V31
2 | 1 | V32
3 | 2 | V33
4 | 3 | V34
5 | 4 | V35
6 | 5 | V36
When the game starts and you shoot at a switch the computer looks at the
value of the variable for that switch and if it equals 1 the force field is
deactivated. Otherwise object 15 (The Laser Cannon) is made visible and it
starts shooting at you.
This is the only area of the game that I have sent in for the
diskmag so you will not be able to go any further.
John Clarke
The Code for this Puzzle
========================
Initial Condition
-----------------
FADEBOUNCE (6)
FADEBOUNCE (7)
INVIS (15)
SETVAR (0,V30)
SETVAR (0,V31)
SETVAR (0,V32)
SETVAR (0,V33)
SETVAR (0,V34)
SETVAR (0,V35)
SETVAR (0,V36)
RANDOM (5,V30)
IF VAREQ? (V30,0)
THEN
SETVAR (1,V31)
ENDIF
IF VAREQ? (V30,1)
THEN
SETVAR (1,V32)
ENDIF
IF VAREQ? (V30,2)
THEN
SETVAR (1,V33)
ENDIF
IF VAREQ? (V30,3)
THEN
SETVAR (1,V34)
ENDIF
IF VAREQ? (V30,4)
THEN
SETVAR (1,V35)
ENDIF
IF VAREQ? (V30,5)
THEN
SETVAR (1,V36)
ENDIF
Switch 1
--------
IF SHOT?
AND VAREQ? (1,V31)
THEN
INVIS (7)
ELSE
VIS (15)
ENDIF
Switch 2
--------
IF SHOT?
AND VAREQ? (1,V32)
THEN
INVIS (7)
ELSE
VIS (15)
ENDIF
Switch 3
--------
IF SHOT?
AND VAREQ? (1,V33)
THEN
INVIS (7)
ELSE
VIS (15)
ENDIF
Switch 4
--------
IF SHOT?
AND VAREQ? (1,V34)
THEN
INVIS (7)
ELSE
VIS (15)
ENDIF
Switch 5
--------
IF SHOT?
AND VAREQ? (1,V35)
THEN
INVIS (7)
ELSE
VIS (15)
ENDIF
Switch 6
--------
IF SHOT?
AND VAREQ? (1,V36)
THEN
INVIS (7)
ELSE
VIS (15)
ENDIF