newgame:
drawmap:
'background
Line (80, 80)-(520, 520), _RGB(128, 15, 15), BF
'floor
Line (100, 100)-(300, 300), _RGB(128, 150, 150), BF
'the walls are drawn if value in matrix is 0
'west wall
Line (100, 100)-(110, 300), _RGB(61, 94, 188), BF
'east wall
Line (290, 100)-(300, 300), _RGB(61, 94, 188), BF
'north wall
Line (100, 100)-(300, 110), _RGB(61, 94, 188), BF
'south wall
Line (100, 290)-(300, 300), _RGB(61, 94, 188), BF
'subroutine tht gives feedback for rooms
infoport:
_Dest textbox&
'after this, anything written goes to this image Print "In search of an escape shuttle, you navigate the rooms.";
Print "Try to avoid alien nests. Some rooms contain a zapper reloader.";
Print "Run out of zaps though, and the aliens will have you." Print " USE w, a, s, d to move between rooms." Print " q quits the game"
Print roominfo
(map
(x
, y
)) _Dest 0 'this sets us back to drawing in the window _PutImage (100, 310), textbox&
'draws lower text box _PutImage (310, 100), textwin&
'draws right text box
charger:
zap = 3
map(x, y) = 3
Print "you found a charger!" Print "your zapper has "; zap;
"blasts" Print "the charger broke!" Print "You can't use it again."
_Dest 0 'back to drawing in window
creature:
zap = zap - 1
map(x, y) = 3
Print "You used a blast!" Print "Your zapper has "; zap;
" blasts left" Print "the creature is gone, the next"
shuttle:
Print "You made it to the shuttle." Print "Still sealed and scanned safe" Print "You escape the ship and set a beacon" Print "It says NEVER BOARD THIS SHIP!"
'you ran out of zapper loads and alien gets you
gameover:
Print "Being as your zapper is empty, the creature" Print "eats you slowly. THE END." Print "Your regret, is never warning others from" Print "coming to this ship."
Print "Try Again (Y/N)?";
'decide to try again
try:
'code for default values for game and loads map
prep:
'load map from data
Restore mapdata
'restore points to label in data table ' this loads map
zap = 3
x = 1
y = 1
'table of text for describing each room
roominfo(1) = "The room is empty"
roominfo(2) = "zapper filled"
roominfo(3) = "scrap litters the floor"
roominfo(4) = "creature!"
roominfo(5) = "shuttle to safety"
'data table laid out in grid for a map
'will read this to a 2 dimensional array and interpret the numbers
'0 is wall, 1 empty room, 2 refills zapper, etc
mapdata:
Data 0,0,0,0,0,0,0,0,0,0,0 Data 0,1,1,1,4,1,1,1,1,1,0 Data 0,1,1,1,2,1,1,4,1,1,0 Data 0,1,1,1,1,1,1,1,1,1,0 Data 0,0,0,0,0,0,0,1,0,0,0 Data 0,2,1,4,1,4,1,1,1,1,0 Data 0,0,1,0,0,0,0,0,0,0,0 Data 0,1,1,0,4,1,1,1,1,1,0 Data 0,2,1,0,1,4,1,1,5,1,0 Data 0,1,1,1,1,4,1,1,1,1,0 Data 0,0,0,0,0,0,0,0,0,0,0