Advertisement
Guest User

spaceInvaders

a guest
Apr 28th, 2013
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.84 KB | None | 0 0
  1.  
  2. w,h=term.getSize() -- 51  19
  3.  
  4. function monSign()
  5.     monitor=peripheral.wrap("top")
  6.     monitor.setTextScale(0.5)
  7.     monW,monH=monitor.getSize()  --w 15  h 10
  8.     monitor.clear()
  9.     monitor.setCursorPos(6,4)
  10.     monitor.write("SPACE")
  11.     monitor.setCursorPos(4,6)
  12.     monitor.write("INVADERS!")
  13. end
  14.  
  15. function initVariables()
  16.     keyPress= 0
  17.     curPos=w/2
  18.     bullet=false
  19.     hPos=h-4
  20.     bulletCurPos=0
  21.     gameTimer=0
  22.     alienW = 5
  23.     alienH = 2
  24.     alienLeftStop=2
  25.     alienRightStop=8
  26.     lives=3
  27.     killed= false
  28.     killCounter=0
  29.     noBombs=true
  30.     bombTimer=0
  31.     win=false
  32.     score=0
  33.  
  34.     alien1 = true
  35.     alien2 = true
  36.     alien3 = true
  37.     alien4 = true
  38.     alien5 = true
  39.     alien6 = true
  40.    
  41.  
  42.     bomb1=false
  43.     bomb2=false
  44.     bomb3=false
  45.  
  46.  
  47.     alienCount=6
  48. end
  49.  
  50. function clear()
  51.       term.clear()
  52.       term.setCursorPos(1,1)
  53.       term.setBackgroundColour(colours.black)
  54.       term.setTextColour(colours.white)
  55. end
  56.  
  57. function gameController()
  58.     local alienMove=1
  59.     local gameTimer = os.startTimer(0.1)
  60.     repeat
  61.        
  62.         local event,p1,p2,p3 = os.pullEvent()
  63.         if event=="key" and killed == false then
  64.             keyPress=p1
  65.             keyAction()
  66.         elseif event=="timer" then
  67.            
  68.             if noBombs==true then
  69.                 bombTimer = bombTimer+1
  70.                 if bombTimer==30 then
  71.                     noBombs=false
  72.                     bombTimer=0
  73.                 end
  74.             end
  75.             bombs()
  76.            
  77.             if killed==true then
  78.                 killCounter=killCounter+1
  79.                     if killCounter==10 then
  80.                         killed=false
  81.                         curPos=w/2
  82.                         killCounter=0
  83.                         drawShip(curPos)
  84.                     end
  85.             end
  86.            
  87.             term.setTextColour(colours.white)
  88.             term.setCursorPos(1,1)
  89.             --print("p1:        "..p1.."  ")
  90.             term.setCursorPos(1,2)
  91.             --print("gameTimer: "..gameTimer.."  ")
  92.             term.setCursorPos(1,3)
  93.             --print("hPos: "..hPos.."  ")
  94.             if p1== gameTimer then
  95.             gameTimer=os.startTimer(0.1)
  96.            
  97.                 if bullet==true then
  98.                     delBullet()
  99.                     hPos=hPos-1
  100.                     if hPos==alienH or HPos==alienH+1 then
  101.                         --checkBulletCollision
  102.                         if alien1 == true and bulletCurPos >= alienW and bulletCurPos <= alienW+3 then
  103.                             delAlien(alienW,alienH)
  104.                             alien1=false
  105.                             alienCount=alienCount-1
  106.                             score=score+50
  107.                             bullet=false
  108.                         elseif alien2 == true and bulletCurPos >= alienW+8 and bulletCurPos <= alienW+11 then
  109.                             delAlien(alienW+8,alienH)
  110.                             alien2=false
  111.                             alienCount=alienCount-1
  112.                             score=score+50
  113.                             bullet=false
  114.                         elseif alien3 == true and bulletCurPos >= alienW+16 and bulletCurPos <= alienW+19 then
  115.                             delAlien(alienW+16,alienH)
  116.                             alien3=false
  117.                             alienCount=alienCount-1
  118.                             score=score+50
  119.                             bullet=false
  120.                         elseif alien4 == true and bulletCurPos >= alienW+24 and bulletCurPos <= alienW+27 then
  121.                             delAlien(alienW+24,alienH)
  122.                             alien4=false
  123.                             alienCount=alienCount-1
  124.                             score=score+50
  125.                             bullet=false
  126.                         elseif alien5 == true and bulletCurPos >= alienW+32 and bulletCurPos <= alienW+35 then
  127.                             delAlien(alienW+32,alienH)
  128.                             alien5=false
  129.                             alienCount=alienCount-1
  130.                             score=score+50
  131.                             bullet=false
  132.                         elseif alien6 == true and bulletCurPos >= alienW+40 and bulletCurPos <= alienW+43 then
  133.                             delAlien(alienW+40,alienH)
  134.                             alien6=false
  135.                             alienCount=alienCount-1
  136.                             score=score+50
  137.                             bullet=false
  138.                         end
  139.                        
  140.                        
  141.                         if alienCount==0 then
  142.                             win=true
  143.                             gameOver()
  144.                         end
  145.                     end
  146.                     if hPos<=1 then
  147.                         bullet=false
  148.                     else
  149.                         drawBullet()
  150.                     end
  151.                 end
  152.                
  153.                 if  score <0 then score = 0 end
  154.                 term.setCursorPos(w-10,h)
  155.                 term.setTextColour(colours.white)
  156.                 write("Score: "..score)
  157.                
  158.                 delAlienFormation()
  159.                 alienW=alienW+alienMove
  160.                 if alien1==false then alienLeftStop = -6 end
  161.                 if alien1==false and alien2==false then alienLeftStop = -14 end
  162.                 if alien1==false and alien2==false and alien3==false then alienLeftStop = -22 end
  163.                 if alien1==false and alien2==false and alien3==false and alien4==false then alienLeftStop = -30 end
  164.                 if alien1==false and alien2==false and alien3==false and alien4==false and alien5 ==false then alienLeftStop = -38 end
  165.                 if alien6==false then alienRightStop = 16 end
  166.                 if alien6==false and alien5==false then alienRightStop = 24 end
  167.                 if alien6==false and alien5==false and alien4==false then alienRightStop = 32 end
  168.                 if alien6==false and alien5==false and alien4==false and alien3==false then alienRightStop = 40 end
  169.                 if alien6==false and alien5==false and alien4==false and alien3==false and alien2 ==false then alienRightStop = 48 end
  170.                
  171.                 if alienW> alienRightStop and alienMove ==1 then alienMove= -1 end -- 8
  172.                 if alienW < alienLeftStop and alienMove == -1 then alienMove= 1 end -- 2
  173.                 drawAlienFormation()
  174.                
  175.                
  176.             end
  177.         end
  178.        
  179.        
  180.     until event=="char" and p1==("x")  
  181. end
  182.  
  183. function getKey()
  184.     input=read()
  185.     print(input.." = "..keys.getName(input))
  186. end
  187.  
  188. function keyAction()
  189.     if keyPress == 30 or keyPress == 203 then
  190.         --left - a or left arrow
  191.         delShip(curPos)
  192.         if curPos>5 then
  193.             curPos=curPos-1
  194.         end
  195.         drawShip(curPos)
  196.     elseif keyPress == 32 or keyPress == 205 then
  197.         --right - d or right arrow
  198.         delShip(curPos)
  199.         if curPos < w-3 then
  200.             curPos=curPos+1
  201.         end
  202.         drawShip(curPos)
  203.     elseif keyPress == 57 then
  204.         -- fire - space bar
  205.         if bullet==false then
  206.             hPos=h-4
  207.             bullet=true
  208.             bulletCurPos = curPos
  209.             drawBullet()
  210.         end
  211.     elseif keyPress == 16 then
  212.         quit()
  213.     end
  214. end
  215.  
  216. function quit()
  217.     os.shutdown()
  218. end
  219.  
  220. function drawShip(wPos)
  221.     term.setTextColour(colours.white)
  222.     term.setBackgroundColour(colours.white)
  223.     term.setCursorPos(wPos,h-3)
  224.     print("X")
  225.     term.setCursorPos(wPos-1,h-2)
  226.     print("XXX")
  227.     term.setCursorPos(wPos-2,h-1)
  228.     print("XXXXX")
  229.     term.setBackgroundColour(colours.black)
  230. end
  231.  
  232. function delShip(wPos)
  233.     term.setTextColour(colours.red)
  234.     term.setBackgroundColour(colours.black)
  235.     term.setCursorPos(wPos,h-3)
  236.     print(" ")
  237.     term.setCursorPos(wPos-1,h-2)
  238.     print("   ")
  239.     term.setCursorPos(wPos-2,h-1)
  240.     print("     ")
  241.     --term.setBackgroundColour(colours.black)
  242. end
  243.  
  244. function drawBullet()
  245.     if bullet==true then
  246.         term.setCursorPos(bulletCurPos,hPos)
  247.         term.setTextColour(colours.orange)
  248.         term.setBackgroundColour(colours.orange)
  249.         print("I")
  250.         term.setTextColour(colours.white)
  251.         term.setBackgroundColour(colours.black)
  252.     end
  253. end
  254.  
  255. function delBullet()
  256.     term.setCursorPos(bulletCurPos,hPos)
  257.     term.setTextColour(colours.black)
  258.     term.setBackgroundColour(colours.black)
  259.     print(" ")
  260.     term.setTextColour(colours.white)
  261.     term.setBackgroundColour(colours.black)
  262. end
  263.  
  264. function drawAlien(aW,aH,num)
  265.     term.setCursorPos(aW,aH)
  266.     term.setTextColour(colours.lime)
  267.     term.setBackgroundColour(colours.lime)
  268.     print(string.rep(num,3))
  269.     term.setCursorPos(aW,aH+1)
  270.     print(string.rep(num,1))
  271.     term.setCursorPos(aW+2,aH+1)
  272.     print(string.rep(num,1))
  273.     term.setTextColour(colours.white)
  274.     term.setBackgroundColour(colours.black)
  275. end
  276.  
  277. function delAlien(aW,aH)
  278.     term.setCursorPos(aW,aH)
  279.     term.setTextColour(colours.black)
  280.     term.setBackgroundColour(colours.black)
  281.     print("   ")
  282.     term.setCursorPos(aW,aH+1)
  283.     print(" ")
  284.     term.setCursorPos(aW+2,aH+1)
  285.     print(" ")
  286.     term.setTextColour(colours.white)
  287.     term.setBackgroundColour(colours.black)
  288. end
  289.  
  290. function drawAlienFormation()
  291.     if alien1==true then drawAlien(alienW,alienH,1) end
  292.     if alien2==true then drawAlien(alienW+8,alienH,2) end
  293.     if alien3==true then drawAlien(alienW+16,alienH,3) end
  294.     if alien4==true then drawAlien(alienW+24,alienH,4) end
  295.     if alien5==true then drawAlien(alienW+32,alienH,5) end
  296.     if alien6==true then drawAlien(alienW+40,alienH,6) end
  297. end
  298.  
  299. function delAlienFormation()
  300.     if alien1==true then delAlien(alienW,alienH) end
  301.     if alien2==true then delAlien(alienW+8,alienH) end
  302.     if alien3==true then delAlien(alienW+16,alienH) end
  303.     if alien4==true then delAlien(alienW+24,alienH) end
  304.     if alien5==true then delAlien(alienW+32,alienH) end
  305.     if alien6==true then delAlien(alienW+40,alienH) end
  306. end
  307.  
  308. function drawBomb(bombW,bombH)
  309.     term.setCursorPos(bombW+1,bombH+2)
  310.     term.setBackgroundColour(colours.yellow)
  311.     term.setTextColour(colours.yellow)
  312.     print("*")
  313.     term.setBackgroundColour(colours.black)
  314.     term.setTextColour(colours.white)
  315. end
  316.  
  317. function delBomb(bombW,bombH)
  318.     term.setCursorPos(bombW+1,bombH+2)
  319.     term.setBackgroundColour(colours.black)
  320.     term.setTextColour(colours.black)
  321.     print(" ")
  322.     term.setBackgroundColour(colours.black)
  323.     term.setTextColour(colours.white)
  324. end
  325.  
  326. function createBomb()
  327.     chance = math.random(5)
  328.     if chance==1 then
  329.         return true
  330.     else
  331.         return false
  332.     end
  333. end
  334.  
  335. function selectAlien()
  336.     selAlien= math.random(6)
  337.     --term.setCursorPos(1,8)
  338.     --term.setTextColour(colours.white)
  339.     --print("aliens left "..alienCount)
  340.     --term.setCursorPos(1,9)
  341.     if selAlien==1 and alien1== true then bombW=alienW
  342.     elseif selAlien==2 and alien2== true then bombW=alienW+8
  343.     elseif selAlien==3 and alien3== true then bombW=alienW+16
  344.     elseif selAlien==4 and alien4== true then bombW=alienW+24
  345.     elseif selAlien==5 and alien5== true then bombW=alienW+32
  346.     elseif selAlien==6 and alien6== true then bombW=alienW+40
  347.     end
  348. end
  349.  
  350. function bombs()
  351.     if bomb1==false and createBomb() == true and noBombs == false then
  352.         selectAlien()
  353.         drawBomb(bombW,alienH)
  354.         bomb1=true
  355.         bomb1W= bombW
  356.         bomb1H=alienH
  357.     elseif bomb1 ==true then
  358.         delBomb(bomb1W,bomb1H)
  359.         bomb1H = bomb1H+1
  360.         if bomb1H ==14 and bomb1W == curPos then
  361.             bomb1=false
  362.             shipHit()
  363.         elseif bomb1H == 15 and bomb1W >= curPos-2 and bomb1W <= curPos then
  364.             bomb1=false
  365.             shipHit()
  366.         elseif bomb1H == 16 and bomb1W >= curPos-4 and bomb1W <= curPos+1 then
  367.             bomb1=false
  368.             shipHit()
  369.         elseif bomb1H > 16 then
  370.             bomb1=false
  371.             term.setCursorPos(1,10)
  372.     print("   ")
  373.         else
  374.             drawBomb(bomb1W,bomb1H)
  375.         end
  376.     end
  377.     if bomb2==false and createBomb() == true and noBombs == false then
  378.         selectAlien()
  379.         drawBomb(bombW,alienH)
  380.         bomb2=true
  381.         bomb2W= bombW
  382.         bomb2H=alienH
  383.     elseif bomb2 ==true then
  384.         delBomb(bomb2W,bomb2H)
  385.         bomb2H = bomb2H+1
  386.         if bomb2H ==14 and bomb2W == curPos then
  387.             bomb2=false
  388.             shipHit()
  389.         elseif bomb2H == 15 and bomb2W >= curPos-2 and bomb2W <= curPos then
  390.             bomb2=false
  391.             shipHit()
  392.         elseif bomb2H == 16 and bomb2W >= curPos-4 and bomb2W <= curPos+1 then
  393.             bomb2=false
  394.             shipHit()
  395.         elseif bomb2H > 16 then
  396.             bomb2=false
  397.             term.setCursorPos(1,10)
  398.     print("   ")
  399.         else
  400.             drawBomb(bomb2W,bomb2H)
  401.         end
  402.     end
  403.     if bomb3==false and createBomb() == true and noBombs == false then
  404.         selectAlien()
  405.         drawBomb(bombW,alienH)
  406.         bomb3=true
  407.         bomb3W= bombW
  408.         bomb3H=alienH
  409.     elseif bomb3 ==true then
  410.         delBomb(bomb3W,bomb3H)
  411.         bomb3H = bomb3H+1
  412.         if bomb3H ==14 and bomb3W == curPos then
  413.             bomb3=false
  414.             shipHit()
  415.         elseif bomb3H == 15 and bomb3W >= curPos-2 and bomb3W <= curPos then
  416.             bomb2=false
  417.             shipHit()
  418.         elseif bomb3H == 16 and bomb3W >= curPos-4 and bomb3W <= curPos+1 then
  419.             bomb3=false
  420.             shipHit()
  421.         elseif bomb3H > 16 then
  422.             bomb3=false
  423.             term.setCursorPos(1,10)
  424.     print("   ")
  425.         else
  426.             drawBomb(bomb3W,bomb3H)
  427.         end
  428.     end
  429. end
  430.  
  431. function shipHit()
  432.     lives=lives-1
  433.     delShip(curPos)
  434.     killed=true
  435.     noBombs=true
  436.     score=score-10
  437.     if score<0 then score =0 end
  438.     if lives==0 then
  439.         gameOver()
  440.     else
  441.         term.setCursorPos(2,h)
  442.         term.setTextColour(colours.white)
  443.         write("Lives: "..lives)
  444.         term.setCursorPos(w-10,h)
  445.         term.setTextColour(colours.white)
  446.         write("Score: "..score)
  447.     end
  448. end
  449.  
  450. function gameOver()
  451.     clear()
  452.     if win==true then
  453.         term.setCursorPos((w/2)-3, h/2)
  454.         print("YOU WIN")
  455.         win=false
  456.     else
  457.         term.setCursorPos((w/2)-4, h/2)
  458.         print("GAME OVER")
  459.     end
  460.     local scoreStr= tostring(score)
  461.     term.setCursorPos((w/2)-((7+#scoreStr))/2, (h/2)+2)
  462.     print("Score: "..scoreStr)
  463.     sleep(1)
  464.     term.setCursorPos((w/2)-9, (h/2)+5)
  465.     print("Play again (Y or N)")
  466.    
  467.  
  468.     while true do
  469.         local event,p1,p2,p3 = os.pullEvent()
  470.         if event=="char" then
  471.             if string.lower(p1)=="y" then
  472.                 runGame()
  473.             elseif string.lower(p1)=="n" then
  474.                 os.shutdown()
  475.             end
  476.         end
  477.     end
  478.  
  479. end
  480.  
  481.  
  482.  
  483. function runGame()
  484.     clear()
  485.    
  486.     initVariables()
  487.     drawShip(curPos)
  488.     drawAlienFormation()
  489.  
  490.     term.setCursorPos(2,h)
  491.     write("Lives: "..lives)
  492.     term.setCursorPos(w-10,h)
  493.     write("Score: "..score)
  494.  
  495.     gameController()
  496. end
  497.  
  498. function line1(h)
  499.     term.setCursorPos(12,h) write("    ")
  500.     term.setCursorPos(18,h) write("    ")
  501.     term.setCursorPos(24,h) write("    ")
  502.     term.setCursorPos(30,h) write("    ")
  503.     term.setCursorPos(36,h) write("    ")
  504. end
  505.  
  506.  
  507. function line2(h)
  508.     term.setCursorPos(12,h) write(" ")
  509.     term.setCursorPos(18,h) write(" ")
  510.     term.setCursorPos(21,h) write(" ")
  511.     term.setCursorPos(24,h) write(" ")
  512.     term.setCursorPos(27,h) write(" ")
  513.     term.setCursorPos(30,h) write(" ")
  514.     term.setCursorPos(36,h) write(" ")
  515. end
  516.    
  517. function line3(h)
  518.     term.setCursorPos(12,h) write("    ")
  519.     term.setCursorPos(18,h) write("    ")
  520.     term.setCursorPos(24,h) write("    ")
  521.     term.setCursorPos(30,h) write(" ")
  522.     term.setCursorPos(36,h) write("   ")
  523. end
  524.  
  525. function line4(h)
  526.     term.setCursorPos(15,h) write(" ")
  527.     term.setCursorPos(18,h) write(" ")
  528.     term.setCursorPos(24,h) write(" ")
  529.     term.setCursorPos(27,h) write(" ")
  530.     term.setCursorPos(30,h) write(" ")
  531.     term.setCursorPos(36,h) write(" ")
  532. end
  533.    
  534. function line5(h)
  535.     term.setCursorPos(12,h) write("    ")
  536.     term.setCursorPos(18,h) write(" ")
  537.     term.setCursorPos(24,h) write(" ")
  538.     term.setCursorPos(27,h) write(" ")
  539.     term.setCursorPos(30,h) write("    ")
  540.     term.setCursorPos(36,h) write("    ")
  541. end
  542.    
  543.    
  544. function line6(h)
  545.     term.setCursorPos(4,h) write("   ")
  546.     term.setCursorPos(9,h) write(" ")
  547.     term.setCursorPos(12,h) write(" ")
  548.     term.setCursorPos(15,h) write(" ")
  549.     term.setCursorPos(18,h) write(" ")
  550.     term.setCursorPos(21,h) write("    ")
  551.     term.setCursorPos(27,h) write("   ")
  552.     term.setCursorPos(33,h) write("    ")
  553.     term.setCursorPos(39,h) write("   ")
  554.     term.setCursorPos(45,h) write("    ")
  555. end
  556.  
  557. function line7(h)
  558.     term.setCursorPos(5,h) write(" ")
  559.     term.setCursorPos(9,h) write("  ")
  560.     term.setCursorPos(12,h) write(" ")
  561.     term.setCursorPos(15,h) write(" ")
  562.     term.setCursorPos(18,h) write(" ")
  563.     term.setCursorPos(21,h) write(" ")
  564.     term.setCursorPos(24,h) write(" ")
  565.     term.setCursorPos(27,h) write(" ")
  566.     term.setCursorPos(30,h) write(" ")
  567.     term.setCursorPos(33,h) write(" ")
  568.     term.setCursorPos(39,h) write(" ")
  569.     term.setCursorPos(42,h) write(" ")
  570.     term.setCursorPos(45,h) write(" ")
  571. end
  572.    
  573. function line8(h)
  574.     term.setCursorPos(5,h) write(" ")
  575.     term.setCursorPos(9,h) write("    ")
  576.     term.setCursorPos(15,h) write(" ")
  577.     term.setCursorPos(18,h) write(" ")
  578.     term.setCursorPos(21,h) write("    ")
  579.     term.setCursorPos(27,h) write(" ")
  580.     term.setCursorPos(30,h) write(" ")
  581.     term.setCursorPos(33,h) write("   ")
  582.     term.setCursorPos(39,h) write("   ")
  583.     term.setCursorPos(45,h) write("    ")
  584. end
  585.  
  586.  
  587. function line9(h)
  588.     term.setCursorPos(5,h) write(" ")
  589.     term.setCursorPos(9,h) write(" ")
  590.     term.setCursorPos(11,h) write("  ")
  591.     term.setCursorPos(15,h) write(" ")
  592.     term.setCursorPos(18,h) write(" ")
  593.     term.setCursorPos(21,h) write(" ")
  594.     term.setCursorPos(24,h) write(" ")
  595.     term.setCursorPos(27,h) write(" ")
  596.     term.setCursorPos(30,h) write(" ")
  597.     term.setCursorPos(33,h) write(" ")
  598.     term.setCursorPos(39,h) write(" ")
  599.     term.setCursorPos(42,h) write(" ")
  600.     term.setCursorPos(48,h) write(" ")
  601. end
  602.    
  603. function line10(h)
  604.     term.setCursorPos(4,h) write("   ")
  605.     term.setCursorPos(9,h) write(" ")
  606.     term.setCursorPos(12,h) write(" ")
  607.     term.setCursorPos(16,h) write("  ")
  608.     term.setCursorPos(21,h) write(" ")
  609.     term.setCursorPos(24,h) write(" ")
  610.     term.setCursorPos(27,h) write("   ")
  611.     term.setCursorPos(33,h) write("    ")
  612.     term.setCursorPos(39,h) write(" ")
  613.     term.setCursorPos(42,h) write(" ")
  614.     term.setCursorPos(45,h) write("    ")
  615. end
  616.  
  617. function whiteScreen()
  618.     term.setBackgroundColour(colours.white)
  619.     term.clear()
  620.     term.setBackgroundColour(colours.black)
  621. end
  622.    
  623. function splashScreen()
  624.     whiteScreen()
  625.     sleep(1)
  626.  
  627.     local scrollH = h+2
  628.     while scrollH > 1 do
  629.         whiteScreen()
  630.         line1(scrollH)
  631.         line2(scrollH+1)
  632.         line3(scrollH+2)
  633.         line4(scrollH+3)
  634.         line5(scrollH+4)
  635.         scrollH=scrollH-1
  636.         sleep(0.1)
  637.     end
  638.     local scrollH = h+2
  639.     while scrollH > 1 do
  640.         whiteScreen()
  641.         line1(2)
  642.         line2(3)
  643.         line3(4)
  644.         line4(5)
  645.         line5(6)
  646.         line6(scrollH+6)
  647.         line7(scrollH+7)
  648.         line8(scrollH+8)
  649.         line9(scrollH+9)
  650.         line10(scrollH+10)
  651.         scrollH=scrollH-1
  652.         sleep(0.1)
  653.     end
  654.     term.setBackgroundColour(colours.white)
  655.     term.setTextColour(colours.black)
  656.    
  657.     term.setCursorPos((w/2)-6,15)
  658.     print("by fredTHead")
  659.    
  660.     term.setCursorPos((w/2)-15,17)
  661.     print("Left and Right Arrows to move")
  662.     term.setCursorPos((w/2)-6,18)
  663.     print("Space to fire")
  664.    
  665.     term.setCursorPos((w/2)-10,19)
  666.     write("Press fire when ready")
  667.    
  668.    
  669.    
  670.     while true do
  671.         local event,p1,p2,p3 = os.pullEvent()
  672.         if event=="char" then
  673.             term.setBackgroundColour(colours.black)
  674.             term.clear()
  675.             runGame()
  676.         end  
  677.     end
  678. end
  679.  
  680.  
  681.  
  682. monSign()
  683. clear()
  684.  
  685. term.setCursorPos(w/2-6 ,h/2)
  686. print("Press any key")
  687. while true do
  688.     local event,p1,p2,p3 = os.pullEvent()
  689.     if event=="char" then
  690.         splashScreen()
  691.     end  
  692. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement