ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >%/ " """"" """"" "" " "" """""""       """"""""""  "     """""""""   " "  "" "" """ ""  ""   "  " " " " " " " " " " " " " " " " " " " " "UPPPPPPPPPPPPPUPPPPPPPPPPPPPPPUPPPUUPUUPUUPUUPUUPUUPUPUUPPPPPPPPPPPPPPPPPPPPPPPPPPPUÌÀÌ À ÀÌ ÀÌ ÀÌÌÌ À ÀÌÀÀ ÀÀ ÀÀ ÀÀ ÀÀ À ÀÀÌÀÌÌÀ ÀÀ ÀÀ ÀÀ ÀÀÌ À ÀÀÌÌÀ À ÀÀ ÀÀÌÌÀÌ À À ÀÀ ÌÀ Ì Ì À ÀÀ ÀÀÌÌÌ À ÀDDD@D@DDDDDDDDDD@DDDDDD@DDDDDDDDDDD@D@DDDDÝÝÐ ÐÐÝ Ý Ý Ð ÝÐÝ Ð ÐÝÐÐ ÐÐ ÐÐ ÐÐÝÝÝÐ ÐÝÝÐ ÐÐ ÐÐ ÐÐÝÝÝ Ð Ð ÝÐÝ Ð ÐÐ ÐÐÐÐÐ ÝÝÐ ÐÐ ÐÝ Ý ÐÐÐÝÝff```ff`fff`f`ff`f`f`f`ff`ff`f`f````f``ff`fff`f```ff``ff`ff``ff`ff`f`f`f````ff````f`````fffff`f```````fffff```ff`fff`ff`f````ª ª     ª  ª      ªª ªª ª ª  ª ªª ªªªªªªªª ª                   ª        ªª   ª ª ª  ªª                 ª  ª       ªªª  ª ªª ª         ª  ª       ª   ª  ªªªª   ªªªª     ª ª      ª  ªª ª  ªª      ªªª ªª ª  ª  ª0333303333030033033033303330303033333333300000030000000033003333333333300003030300300033033333333333000000300033000000003333333330330303303300033300030333ÌÌÌÌ ÌÌÀÌ ÀÌÌÌ ÀÌ ÀÌÌÌÀÌ ÀÌÀÌÌ ÀÀ ÀÀÌ ÀÀÌ Ì ÀÀÀ ÀÀÌ ÌÀ À ÀÀ À ÀÌÌ Ì ÌÌ Ì Ì À ÀÀ À À ÀÀ ÀÀÀÀÀÌÀ Ì ÌÌÀ À ÀÀÌ À ÀÌÌ Ì ÌÀ Ì Ì ÌÌ À ÀÀ ÀÀÀ ÀÀ ÀÀÌÌÀÌÌ ÌÌÌÀ ÀÌ À ÀÌÌÌÌ ÌÌÌ Ì Ì ÌÀ À ÀÀÌ À ÀÀ ÀÀÌÌÀ Ì Ì ÌÌ À À ÀÀÌÌÀ ÀÌÀÌÌ ÀÌ ÀÌÀÌÌ ÀÌ À ÀÀÌ Ì À ÌÀ ÀÀ°-- title: Tower of Terror -- author: Fer_nando -- desc: Usborne's Tower of Terror -- license: MIT License -- version: 2.0 -- script: lua rnd=math.random rows={} state="info" function info() cls() pr("TOWER OF TERROR",2,0,1) pr("Your mouth is dry, your legs are shaking",12,2,1.14) pr("and your heart is thumping",12,3,1.13) pr("-you've entered the Tower of Terror...",12,4,1.15) pr("Agh!! there's a skeleton, a ghost..",12,5,1.19) pr(" and other monsters!",12,6,1.07) pr("Will you go on (UP)",12,7,1.25) pr(" or retreat (DOWN) to recover a little?",12,8,1.12) pr("Watch the time, you've only got until midnight",12,9) pr("to reach the top floor of the Tower",12,10,1.1) pr("and the coveted Treasure.",12,11,1.1) pr("Watch your pulse rate too.",12,12,1.1) pr("Madness takes over when it reaches 150",12,13,1.09) pr("and nothing can stop you",12,14,1.1) pr("leaping to your doom through the window!",12,15,1.12) pr("Press Z to continue",3,16,1.12) if btnp(4) then state="init" end end function init() cls() monsters = { "SKELETON", "GHOST", "ZOMBIE", "HEADLESS AXEMAN" } room=0 hour=9 min=rnd(10)+10 pulse=50 comment="GOOD LUCK!!" chance=0 monstertype=0 state="main" end function main() pr("TOWER OF TERROR",2,1,1.1) pr("---------------------",2,2,1.55) pr(comment,5,3,1.18) floor = room//5 actualroom=room-floor*5+1 pr("YOU ARE ON",12,5) if floor==0 then pr("THE GROUND FLOOR",4,6) end if floor==6 then pr("THE TOP FLOOR",4,6) end if floor>0 and floor<6 then pr("FLOOR "..floor,4,6) end pr("IN ROOM "..actualroom,13,7) pr("THE TIME IS "..hour.."."..min.." PM",6,8) pr("YOUR PULSE RATE IS "..pulse, 10, 9) if chance==0 then chance=rnd(1,9) end if chance>6 and monstertype==0 then monstertype=rnd(1,#monsters) w=monsters[monstertype] shock=rnd(1,5)+floor+monstertype*2 flag=1 end if monstertype>0 then pr("AHEAD YOU SEE A "..w,3,10) end pr("RETREAT OR GO ON (UP/DOWN)",12,12) state="input" end function input() if btnp(0) then monstertype=0 comment="" room=room+1 if flag==1 then pulse=pulse+shock*2 comment="AHHHHHH!!" end pulse=pulse-1 flag=0 state="logic" elseif btnp(1) then comment="" room=room-1 pulse=pulse-5 monstertype=0 flag=0 state="logic" end end function logic() cls() if room<0 then room=0 end min=min+rnd(1,3) if min>59 then min=min-60 hour=hour+1 end if pulse<40 then pulse=40 end if floor==chance and floor>1 and rnd(10)>5 then comment="YOU FELL THROUGH A TRAP DOOR! " room=room-5 pulse=pulse+10 end chance=0 if hour==12 then ending="late" state="fin" elseif pulse>150 then ending="pulse" state="fin" elseif room==30 then ending="win" state="fin" else state="main" end end function fin() cls() clearPr() pr("GAME OVER",2,4,1) pr("PRESS 'Z' TO PLAY AGAIN",4,5,1.1) if ending=="pulse" then pr("YOU HAVE GONE MAD AND\nLEAPT FROM THE WINDOW..!",12,1) elseif ending=="late" then pr("IT'S MIDNIGHT.\nTOO LATE FOR YOU..",12,1) elseif ending=="win" then pr("YOU REACHED THE TOP FLOOR\nWELL DONE!",12,1) end if btnp(4) then state="init" end end function TIC() if state=="info" then info() elseif state=="init" then init() elseif state=="main" then main() elseif state=="input" then input() elseif state=="logic" then logic() elseif state=="fin" then fin() end end function drawPr() for index, text in ipairs(rows) do print(text.string,text.h,text.pos*8,text.color) table.remove(rows,index) end end function clearPr() cls() rows={} end function pr(string,color,pos,offset) local text = { string=string, color=color, pos=pos,h=0 } if offset then text.h=120-#string*6/offset/2 end table.insert(rows, text) drawPr(c) end