Advertisement
Eedoboy

Mine blast

Jan 23rd, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.54 KB | None | 0 0
  1.  
  2. -- mine blast
  3. -- Use this function to perform your initial setup
  4. function setup()
  5. setInstructionLimit(0)
  6. print("Touch and hold mine until it deactivates")
  7. print("The quicker u get to the mine the more points you gain")
  8. print("bonus points awarded at end for deactivate mines")
  9. mylevel = 0
  10. mynewlevel = 1
  11. myradius = 11
  12. mycount = 1
  13. myxplaces={124,224,324,424,524,624}
  14. myyplaces={128,210,294,376,456,536}
  15.  
  16. mylives=36
  17. mylifedecrease = 0
  18. mywall=""
  19. myground=""
  20.  
  21. --get first real random number
  22. mynumber=math.random(1,6)
  23. mynumber2=math.random(1,6)
  24.  
  25. myplace=myxplaces[mynumber]
  26. myplace2=myyplaces[mynumber2]
  27. mybackground = 1
  28. myscore=0
  29. myhits=0
  30. mymines=0
  31. mybonus=0
  32. mylevel=0
  33. mystate=1
  34. mylevelamount = .6
  35. z=1
  36. y=1
  37. x=1
  38. w=1
  39. v=1
  40. u=1
  41.  
  42.  
  43. -- populate 6 by 6 array with 6 rows numbered 1 to 6
  44. -- this is used as the mine grid
  45. myrow={}
  46. for c = 1,6 do
  47.    myrow[c] = {}
  48.     for d = 1,6 do
  49.         myrow[c][d] = d
  50.     end
  51. end 
  52. myrow[mynumber][mynumber2]=0
  53.     
  54. backingMode(RETAINED)
  55. end
  56.  
  57. -- This function gets called once every frame
  58. function draw()
  59.  
  60. if mystate==1 and mylives>0 then
  61.     if mybackground < 2 then
  62.     -- draw background blocks and initial grid of mines
  63.         getgrid()
  64.         mybackground = 2
  65.     end
  66.     
  67.     if w<=31 and mynewlevel >1 then
  68.         fill(1, 1, 1, 255)
  69.         stroke(10, 11, 10, 255)
  70.         rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  71.         printword("BONUS "..mybonus,w)
  72.         if w<=30.3 then 
  73.             w=w+.3
  74.         else 
  75.             w=31
  76.             fill(1, 1, 1, 255)
  77.             stroke(10, 11, 10, 255)
  78.             rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  79.             w=32
  80.         end
  81.     else
  82.         printword("LEVEL"..mynewlevel,v)
  83.         if v<=30.3 then 
  84.             v=v+.3
  85.         else 
  86.             v=31
  87.         end
  88.      end
  89.     
  90.     if v==31 then
  91.         fill(1, 1, 1, 255)
  92.         stroke(10, 11, 10, 255)
  93.         rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  94.           
  95.         printword("ARE",z)
  96.         if z<=30.3 then 
  97.             z=z+.3
  98.         else 
  99.             z=31
  100.         end
  101.     end
  102.     
  103.     if z==31 then 
  104.         fill(1, 1, 1, 255)
  105.         stroke(10, 11, 10, 255)
  106.         rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  107.     
  108.         printword("YOU",y)
  109.         if y<=30.3 then 
  110.             y=y+.3
  111.         else 
  112.             y=31
  113.         end
  114.     end
  115.         if y==31 then 
  116.             fill(1, 1, 1, 255)
  117.             stroke(10, 11, 10, 255)
  118.             rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  119.       
  120.             printword("READY",x)
  121.             if x<=30.3 then 
  122.                 x=x+.3
  123.             else 
  124.                 x=31
  125.             end
  126.         end
  127.     
  128.         if x==31 then 
  129.             fill(1, 1, 1, 255)
  130.             stroke(10, 11, 10, 255)
  131.             rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  132.             
  133.             printword("GO",u)
  134.             if u<=30.3 then 
  135.                 u=u+.3
  136.             else 
  137.                 u=31
  138.             end
  139.        end     
  140.             if u == 31 then 
  141.                 fill(1, 1, 1, 255)
  142.                 stroke(10, 11, 10, 255)
  143.                 rect(5,(HEIGHT-10)-100,WIDTH,HEIGHT -10)
  144.                 mystate=0
  145.                 mylevel=mylevel+mynewlevel
  146.             end
  147.     
  148.     
  149. end
  150.  
  151. if mylevel >0 and mylives >0 then
  152.     
  153.     
  154.     if mycount < 2 then -- new mine activated
  155.         if myradius == 11 then
  156.             stroke(5, 238, 252, 255)
  157.             strokeWidth(8)
  158.             number(10, HEIGHT -10, "SCORE "..myscore, 20)
  159.             fill(1, 1, 1, 255)
  160.             stroke(10, 11, 10, 255)
  161.             strokeWidth(5)
  162.             rect(5,HEIGHT -105,150,30)
  163.             strokeWidth(5)
  164.             stroke(5, 238, 252, 255)
  165.             number(10, HEIGHT -80, "STRENGTH ", 10)
  166.             stroke(255, 0, 212, 255)
  167.             strokeWidth(5)
  168.             rect(160,HEIGHT -105,360,30)
  169.             stroke(4, 4, 4, 255)
  170.             strokeWidth(0)
  171.             if mylives <6 then 
  172.                 fill(242, 50, 16, 255)
  173.             elseif mylives > 6 and mylives < 24 then
  174.                 fill(242, 129, 16, 255)
  175.             else
  176.                 fill(17, 242, 38, 255)
  177.             end
  178.             rect(163,HEIGHT -102,mylives*10-5,24)
  179.         end
  180.         -- expand active mine radius by level amount
  181.         if myradius < 31 then
  182.             fill(20, 244, 4, 255)
  183.             myradius = myradius + mylevelamount
  184.         else
  185.             mycount = mycount + 1  
  186.         end
  187.     else 
  188.         -- decrease active mine radius by 1
  189.         fill(244, 10, 5, 255)
  190.         myradius = myradius - mylevelamount
  191.     end
  192.     
  193.     -- Draw active mine radius
  194.     ellipseMode(3)
  195.     ellipse(myplace,myplace2,myradius,myradius)
  196.     sprite("Tyrian Remastered:Button Glow",myplace,myplace2)
  197.  
  198.     -- check if player is pressing on mine if so 
  199.     -- give player points and mark mine as deactivated
  200.     checkforpoints()
  201.     
  202.     if myradius < 11 then -- active mine is at smallest radius
  203.      
  204.             markhitormiss() -- check if mine deactivated or explosion
  205.             checkforlevel() -- check if end of level
  206.             fill(1, 1, 1, 255)
  207.             stroke(10, 11, 10, 255)
  208.             strokeWidth(5)
  209.             rect(5,HEIGHT -105,150,30)
  210.             strokeWidth(5)
  211.             stroke(5, 238, 252, 255)
  212.             number(10, HEIGHT -80, "STRENGTH ", 10)
  213.             stroke(255, 0, 212, 255)
  214.             strokeWidth(5)
  215.             rect(160,HEIGHT -105,360,30)
  216.             stroke(4, 4, 4, 255)
  217.             strokeWidth(0)
  218.             if mylives <6 then 
  219.                 fill(242, 50, 16, 255)
  220.             elseif mylives > 6 and mylives < 24 then
  221.                 fill(242, 129, 16, 255)
  222.             else
  223.                 fill(17, 242, 38, 255)
  224.             end
  225.             rect(163,HEIGHT -102,mylives*10-5,24)
  226.             
  227.             if mylevel>0 and mylives >0 then
  228.                 mycount = 1 -- get ready to expand activated mine
  229.                 repeat -- get new random mine to activate
  230.                     mynumber=math.random(1,6)
  231.                     mynumber2=math.random(1,6)
  232.                 until myrow[mynumber][mynumber2] ~= 0 and myrow[mynumber][mynumber2] ~= 7
  233.                 myrow[mynumber][mynumber2]=0 -- mark as activated
  234.                 myplace=myxplaces[mynumber]
  235.                 myplace2=myyplaces[mynumber2]  
  236.             end
  237.             
  238.     end
  239.     
  240. end
  241. end
  242.  
  243.  
  244. function markhitormiss()
  245.     -- if mine deactivated colour blue else blowup
  246.     if myrow[mynumber][mynumber2]==7 then
  247.         sprite("Tyrian Remastered:Eye Mecha",myplace,myplace2-4)
  248.         mylifedecrease=0
  249.     else
  250.         sound(SOUND_EXPLODE,1000)
  251.         sprite("Tyrian Remastered:Explosion Huge",myplace,myplace2-6)
  252.         mylifedecrease=1
  253.     end
  254. end
  255.  
  256. function checkforlevel()
  257.     myhits = 0
  258.     mymines = 0
  259.     for c = 1,6 do 
  260.         for d = 1,6 do
  261.             if myrow[c][d] == 0 then
  262.                 mymines = mymines+1
  263.             end
  264.             if myrow[c][d] == 7 then
  265.                 myhits = myhits + 1
  266.             end
  267.         end
  268.     end
  269.     
  270.     mylives = mylives - mylifedecrease
  271.     
  272.     
  273. -- if no mines left end level
  274.     if mymines+myhits == 36 then
  275.         
  276.             -- calculate bonus based on deactivated mines
  277.             -- and add to score
  278.         
  279.             stroke(10, 11, 10, 255)
  280.             strokeWidth(10)
  281.             number(10, HEIGHT -10, "SCORE "..myscore, 20) 
  282.             mybonus = 0
  283.             mybonus = mybonus + (myhits * 10)
  284.             
  285.             if myhits > 6 and myhits <13 then
  286.                 mylives = mylives + 1
  287.             elseif myhits > 12 and myhits < 19 then
  288.                 mylives = mylives + 2
  289.             elseif myhits > 18 and myhits < 25 then
  290.                 mylives = mylives + 3
  291.             elseif myhits > 24 and myhits < 31 then
  292.                 mylives = mylives + 4
  293.             elseif myhits > 30 then
  294.                 mylives = mylives + 5
  295.             end
  296.             
  297.             -- dont let bonus strength go over full strength
  298.             if mylives > 36 then
  299.                 mylives = 36
  300.             end
  301.         
  302.         
  303.             fill(1, 1, 1, 255)
  304.             stroke(10, 11, 10, 255)
  305.             rect(5,(HEIGHT-10)-70,WIDTH,HEIGHT -10)
  306.             myscore = myscore + mybonus
  307.             mynewlevel=mynewlevel+1
  308.             mylevelamount=mylevelamount+.2
  309.            
  310.             if mylives > 0 then
  311.                 resetvalues()
  312.             end
  313.     
  314.     end
  315.     
  316.     if mylives<=0 then
  317.         stroke(5, 238, 252, 255)
  318.         strokeWidth(8)
  319.         number(10, HEIGHT -10, "SCORE "..myscore, 20)
  320.         number(450, HEIGHT -10, "GAME OVER ", 20)
  321.     end
  322. end
  323.  
  324. function checkforpoints()
  325.     if CurrentTouch.state==BEGAN or CurrentTouch.state==MOVING then
  326.         if CurrentTouch.x <= myplace + 30 and CurrentTouch.x >= myplace - 30 then
  327.             if CurrentTouch.y <= myplace2 + 30 and CurrentTouch.y >= myplace2 - 30 then
  328.                 stroke(10, 11, 10, 255)
  329.                 strokeWidth(10)
  330.                 number(10, HEIGHT -10, "SCORE "..myscore, 20)
  331.                 myscore = myscore + 1
  332.                 stroke(5, 238, 252, 255)
  333.                 strokeWidth(8)
  334.                 number(10, HEIGHT -10, "SCORE "..myscore, 20)
  335.                 sound(SOUND_PICKUP,2000)
  336.                 myrow[mynumber][mynumber2] = 7
  337.            end
  338.         end
  339.     end
  340. end
  341.  
  342.  
  343. function getgrid()
  344.     
  345.     if mystate==0 then
  346.         stroke(5, 238, 252, 255)
  347.         strokeWidth(8)
  348.         number(10, HEIGHT -10, "SCORE "..myscore, 20)
  349.     end
  350.  
  351.  
  352.     -- render background sprites (bricks)
  353.     for i = 0,7 do
  354.        for a = 0,7 do
  355.        -- sprite("Planet Cute:Stone Block",a * 100 -1,740)
  356.         if a==0 or a==7 then
  357.             --wall
  358.             if mynewlevel==1 then
  359.                 sprite("Planet Cute:Dirt Block",(a * 100 -1)+25,620-(i*82))
  360.             elseif mynewlevel==2 then
  361.                 sprite("Planet Cute:Stone Block",(a * 100 -1)+25,620-(i*82))
  362.             elseif mynewlevel==3 then
  363.                 sprite("Planet Cute:Grass Block",(a * 100 -1)+25,620-(i*82))
  364.             elseif mynewlevel==4 then
  365.                 sprite("Planet Cute:Plain Block",(a * 100 -1)+25,620-(i*82))
  366.             else
  367.                 sprite("Planet Cute:Wall Block",(a * 100 -1)+25,620-(i*82))
  368.             end
  369.         
  370.                 
  371.         else
  372.             if i ==0 or i==7 then
  373.                 --wall
  374.                 if mynewlevel==1 then
  375.                         sprite("Planet Cute:Dirt Block",(a * 100 -1)+25,620-(i*82))
  376.                 elseif mynewlevel==2 then
  377.                         sprite("Planet Cute:Stone Block",(a * 100 -1)+25,620-(i*82))
  378.                 elseif mynewlevel==3 then
  379.                         sprite("Planet Cute:Grass Block",(a * 100 -1)+25,620-(i*82))
  380.                 elseif mynewlevel==4 then
  381.                         sprite("Planet Cute:Plain Block",(a * 100 -1)+25,620-(i*82))
  382.                 else
  383.                     sprite("Planet Cute:Wall Block",(a * 100 -1)+25,620-(i*82))
  384.                 end
  385.                 
  386.                 if (a==2 or a==5) then
  387.                         sprite("Planet Cute:Chest Open",(a * 100 -1)+25,620-(i*82))
  388.                 end
  389.             else
  390.                 -- ground
  391.                 if mynewlevel==1 then
  392.                     sprite("Planet Cute:Stone Block",(a * 100 -1)+25,620-(i*82))
  393.                 elseif mynewlevel==2 then
  394.                     sprite("Planet Cute:Grass Block",(a * 100 -1)+25,620-(i*82))
  395.                 elseif mynewlevel==3 then
  396.                     sprite("Planet Cute:Brown Block",(a * 100 -1)+25,620-(i*82))
  397.                 elseif mynewlevel==4 then
  398.                     sprite("Planet Cute:Ramp South",(a * 100 -1)+25,620-(i*82))
  399.                 else
  400.                     sprite("Planet Cute:Water Block",(a * 100 -1)+25,620-(i*82))
  401.                 end
  402.                     
  403.             end
  404.         end
  405.       -- sprite("Planet Cute:Dirt Block",a * 100 -1,60) 
  406.        end
  407.     end
  408.     
  409.     
  410.     for i = 1,6 do
  411.         for a = 0,7 do
  412.             if a > 0 and a < 7 then 
  413.              sprite("Tyrian Remastered:Orb 1",(a * 100 -1)+25,620-(i*82)) --place initial mines
  414.            end
  415.         end
  416.     end
  417. end
  418.  
  419. function printword(myword,z)
  420.      stroke(10, 11, 10, 255)
  421.      strokeWidth(12)
  422.      number((WIDTH/2)-((#myword/2)*30), HEIGHT -10, myword, z)    
  423.      stroke(5, 238, 252, 255)
  424.      strokeWidth(10)
  425.      number((WIDTH/2)-((#myword/2)*30), HEIGHT -10, myword, z)
  426. end
  427.  
  428. function resetvalues()
  429.     myradius = 11
  430.     mycount = 1
  431.     myxplaces={124,224,324,424,524,624}
  432.     myyplaces={128,210,294,376,456,536}
  433.     --myyplaces={140,220,300,380,460,540}
  434.  
  435.     --get first real random number
  436.     mynumber=math.random(1,6)
  437.     mynumber2=math.random(1,6)
  438.  
  439.     myplace=myxplaces[mynumber]
  440.     myplace2=myyplaces[mynumber2]
  441.     mybackground = 1
  442.     myhits=0
  443.     mymines=0
  444.     mylevel=0
  445.     mystate=1
  446.     mylifedecrease = 0
  447.     z=1
  448.     y=1
  449.     x=1
  450.     w=1
  451.     u=1
  452.     v=1
  453.  
  454. -- populate 6 by 6 array with 6 rows numbered 1 to 6
  455. -- this is used as the mine grid
  456. myrow={}
  457. for c = 1,6 do
  458.    myrow[c] = {}
  459.     for d = 1,6 do
  460.         myrow[c][d] = d
  461.     end
  462. end 
  463. myrow[mynumber][mynumber2]=0
  464. end
  465. -----------------------------------
  466. -- Functions for drawing numbers --
  467. -----------------------------------
  468.  
  469.  
  470. -- Draw a number. x, y is top left
  471. function number(x, y, n, w)
  472.     l = string.len(n)
  473.     for i = 1, l do
  474.         drawDigit(x + ((i - 1) * (w * 1.5)), y, string.sub(n, i, i), w)
  475.     end
  476. end
  477.  
  478. -- Draw a single digit
  479. function drawDigit(x, y, n, w)
  480.     h = 2 * w
  481.     if string.match(n, "1") then
  482.         line(x + (w / 2), y, x + (w / 2), y - h)
  483.     elseif string.match(n, "2") then
  484.         line(x, y, x + w, y)
  485.         line(x + w, y, x + w, y - (h / 2))
  486.         line(x + w, y - (h / 2), x, y - (h / 2))
  487.         line(x, y - (h / 2), x, y - h)
  488.         line(x, y - h, x + w, y - h)
  489.     elseif string.match(n, "3") then
  490.         line(x, y, x + w, y)
  491.         line(x + w, y, x + w, y - h)
  492.         line(x + w, y - h, x, y - h)
  493.         line(x, y - (h / 2), x + w, y - (h / 2))
  494.     elseif string.match(n, "4") then
  495.         line(x, y, x, y - (h / 2))
  496.         line(x, y - (h / 2), x + w, y - (h / 2))
  497.         line(x + w, y, x + w, y - h)
  498.     elseif string.match(n, "5") then
  499.         line(x + w, y, x, y)
  500.         line(x, y, x, y - (h / 2))
  501.         line(x, y - (h / 2), x + w, y - (h / 2))
  502.         line(x + w, y - (h / 2), x + w, y - h)
  503.         line(x + w, y - h, x, y - h)
  504.     elseif string.match(n, "6") then
  505.         line(x + w, y, x, y)
  506.         line(x, y, x, y - h)
  507.         line(x, y - h, x + w, y - h)
  508.         line(x + w, y - h, x + w, y - (h / 2))
  509.         line(x + w, y - (h / 2), x, y - (h / 2))
  510.     elseif string.match(n, "7") then
  511.         line(x, y, x + w, y)
  512.         line(x + w, y, x + w, y - h)
  513.     elseif string.match(n, "8") then
  514.         line(x, y, x + w, y)
  515.         line(x + w, y, x + w, y - h)
  516.         line(x + w, y - h, x, y - h)
  517.         line(x, y - h, x, y)
  518.         line(x, y - (h / 2), x + w, y - (h / 2))
  519.     elseif string.match(n, "9") then
  520.         line(x + w, y - (h / 2), x, y - (h / 2))
  521.         line(x, y - (h / 2), x, y)
  522.         line(x, y, x + w, y)
  523.         line(x + w, y, x + w, y - h)
  524.         line(x + w, y - h, x, y - h)
  525.     elseif string.match(n, "0") then
  526.         line(x, y, x + w, y)
  527.         line(x + w, y, x + w, y - h)
  528.         line(x + w, y - h, x, y - h)
  529.         line(x, y - h, x, y)
  530.     elseif string.match(n, "x") then
  531.         line(x, y - (w / 3), x + w, y - (h + 1))
  532.         line(x + w, y - (w / 3), x, y - (h + 1))
  533.     elseif string.match(n, "A") then
  534.         line(x, y, x + w, y) -- across top
  535.         line(x, y - h, x, y) --down left
  536.         line(x + w, y, x + w, y - h) -- down right
  537.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  538.     elseif string.match(n, "B") then
  539.         line(x, y, x + (w/2), y) --across top
  540.         line(x + w, y-(h/4), x + w, y-h+(h/4))-- down right
  541.         line(x, y - h, x + (w/2), y - h)-- across bottom
  542.         line(x, y - h, x, y)-- down left
  543.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  544.         line(x + (w/2), y - h,x + w, y-h+(h/4))-- bottom diag
  545.         line(x + (w/2), y,x + w, y-(h/4)) --top diag
  546.     elseif string.match(n, "C") then
  547.         line(x, y - h, x, y) --down left
  548.         line(x + w, y - h, x, y - h)-- across bottom
  549.         line(x, y, x + w, y) --across top
  550.      elseif string.match(n, "D") then
  551.         line(x, y, x + (w/2), y) --across top
  552.         line(x + w, y-(h/4), x + w, y-h+(h/4))-- down right
  553.         line(x, y - h, x + (w/2), y - h)-- across bottom
  554.         line(x, y - h, x, y)-- down left
  555.         line(x + (w/2), y - h,x + w, y-h+(h/4))-- bottom diag
  556.         line(x + (w/2), y,x + w, y-(h/4)) --top diag   line(x, y, x + w, y) -- across top
  557.     elseif string.match(n, "E") then
  558.         line(x, y - h, x, y) --down left
  559.         line(x + w, y - h, x, y - h)-- across bottom
  560.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  561.         line(x, y, x + w, y) -- across top
  562.     elseif string.match(n, "F") then
  563.         line(x, y - h, x, y) --down left
  564.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  565.         line(x, y, x + w, y) -- across top
  566.     elseif string.match(n, "G") then
  567.         line(x, y - h, x, y) --down left
  568.         line(x + w, y - h, x, y - h)-- across bottom
  569.         line(x, y, x + w, y) --across top
  570.         line(x + w, y - h, x + w, y - (h / 2))
  571.         line(x + w, y - (h / 2),x+(w/2),y - (h / 2))
  572.     elseif string.match(n, "H") then
  573.         line(x, y - h, x, y) --down left
  574.         line(x + w, y, x + w, y - h) -- down right
  575.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid 
  576.     elseif string.match(n, "I") then
  577.         line(x + (w / 2), y, x + (w / 2), y - h)
  578.         line(x, y, x + w, y) -- across top
  579.         line(x + w, y - h, x, y - h)-- across bottom
  580.     elseif string.match(n, "J") then
  581.         line(x + w, y, x + w, y - h) -- down right
  582.         line(x + w, y - h, x, y - h)-- across bottom
  583.     elseif string.match(n, "K") then
  584.         line(x, y - h, x, y) --down left
  585.         line(x, y - (h / 2),x+w,y) -- top diag
  586.         line(x, y - (h / 2),x+w,y-h) -- bottom diag
  587.     elseif string.match(n, "L") then
  588.         line(x, y - h, x, y) --down left
  589.         line(x + w, y - h, x, y - h)-- across bottom
  590.     elseif string.match(n, "M") then
  591.         line(x, y - h, x, y) --down left
  592.         line(x + w, y, x + w, y - h) -- down right
  593.         line(x + w, y,x+(w/2),y-(h/2)) -- right diag
  594.         line(x+(w/2),y-(h/2),x,y) -- left diag
  595.     elseif string.match(n, "N") then
  596.         line(x, y - h, x, y) --down left
  597.         line(x + w, y, x + w, y - h) -- down right
  598.         line(x, y,x+w,y-h) -- diag
  599.     elseif string.match(n, "O") then
  600.         line(x, y, x + w, y)
  601.         line(x + w, y, x + w, y - h)
  602.         line(x + w, y - h, x, y - h)
  603.         line(x, y - h, x, y)
  604.     elseif string.match(n, "P") then
  605.         line(x, y, x + w, y) -- across top
  606.         line(x, y - h, x, y) --down left
  607.         line(x + w, y,  x + w, y - (h / 2)) -- down right
  608.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  609.     elseif string.match(n, "Q") then
  610.         line(x, y, x + w, y)
  611.         line(x + w, y, x + w, y - h)
  612.         line(x + w, y - h, x, y - h)
  613.         line(x, y - h, x, y)
  614.         line(x+(w/4), y - h + (h/4), x-(w/4), y-h-(h/4))
  615.     elseif string.match(n, "R") then
  616.         line(x, y, x + w, y) -- across top
  617.         line(x, y - h, x, y) --down left
  618.         line(x + w, y,  x + w, y - (h / 2)) -- down right
  619.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  620.         line(x, y - (h / 2),x+w,y-h) -- bottom diag
  621.     elseif string.match(n, "S") then
  622.         line(x, y, x + w, y) -- across top
  623.         line(x, y - (h / 2), x + w, y - (h / 2)) -- across mid
  624.         line(x + w, y - h, x, y - h)-- across bottom
  625.         line(x, y - (h / 2), x, y) -- down left
  626.         line(x + w, y - (h / 2), x+w, y - h) -- down right
  627.     elseif string.match(n, "T") then
  628.         line(x + (w / 2), y, x + (w / 2), y - h)
  629.         line(x, y, x + w, y) -- across top
  630.     elseif string.match(n, "U") then
  631.         line(x, y - h, x, y) --down left
  632.         line(x + w, y, x + w, y - h) -- down right
  633.         line(x + w, y - h, x, y - h)-- across bottom
  634.     elseif string.match(n, "V") then
  635.         line(x, y, x+(w/2), y-h) --down left
  636.         line(x + w, y, x+(w/2), y - h) -- down right
  637.     elseif string.match(n, "W") then
  638.         line(x, y - h, x, y) --down left
  639.         line(x + w, y, x + w, y - h) -- down right
  640.         line(x + w, y - h, x+(w/2),y-(h/2)) --right diag
  641.         line(x, y - h, x+(w/2),y-(h/2)) --right diag    
  642.     elseif string.match(n, "X") then
  643.         line(x, y, x+w, y-h) --diag left
  644.         line(x + w, y, x, y - h) -- diag right
  645.     elseif string.match(n, "Y") then
  646.         line(x, y, x+(w/2), y-(h/2)) --diag left
  647.         line(x + w, y, x+(w/2), y-(h/2))  -- diag right
  648.         line(x + (w/2), y-h, x+(w/2), y-(h/2))  -- down middle
  649.     elseif string.match(n, "Z") then
  650.         line(x, y, x + w, y) -- across top
  651.         line(x + w, y - h, x, y - h)-- across bottom
  652.         line(x + w, y, x, y - h) -- diag right
  653.     end
  654. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement