Advertisement
xerpi

rrwrew

Jul 17th, 2011
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.48 KB | None | 0 0
  1. lcb = 0
  2. function loadcallback()
  3. screen.print(370,255,string.sub("Kaboom!!!!",1,math.floor(lcb)))
  4. screen.flip()
  5. lcb = lcb + 1.5
  6. end
  7.  
  8. --SCENERYBETA SPLASH HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  9.  
  10.  
  11. os.cpu(333) --A little powah for loading all
  12. if os.language() == "spanish" then
  13.     _moves = "movidas: %i"
  14.     _level = "Nivel %i"
  15.     _level_completed = "Nivel completado."
  16.     _record = "Récord: %i"
  17.     _congrats = "Felicidades, has compltado el juego!\n¿Deseas volver a jugar?"
  18. else
  19.     _moves = "moves: %i"
  20.     _level_completed = "Level completed."
  21.     _level = "Level %i"
  22.     _record = "Record: %i"
  23.     congrats = "Congratulations, you have completed the game!\nWould you like to play again?"
  24. end
  25.  
  26. prism = {obj=model.load("models/prism.obj")}
  27. sel = {obj=model.load("models/selector.obj"),x=1,y=1}
  28. sel2 = {obj=model.load("models/selector2.obj"),x=1,y=1,rot=0}
  29. exit = {obj=model.load("models/exit.obj")}
  30. cube = {obj=model.load("models/cube.obj")}
  31. floor = {obj=model.load("models/floor.obj")}
  32. bg = image.load("images/background.png")
  33.  
  34. record = {}
  35.  
  36. cnv = tonumber(ini.read("config.ini","currentlevel",1)) or 1 --Currentlevel
  37.  
  38.  
  39. map = {
  40. {
  41. --Level 1
  42. {"","","","",""},
  43. {"v","c","","",""},
  44. {"","","","",""},
  45. {"","","c","",""},
  46. {"","","e","",""}
  47. },
  48. {
  49. --Level 2
  50. {"", "", "", "d", "c", "", "", ""},
  51. {"", "", "", "", "", "", "", ""},
  52. {"", "c", "", "c", "", "", "", "c"},
  53. {"", "", "", "", "", "c", "", ""},
  54. {"", "", "c", "", "", "", "", ""},
  55. {"", "", "", "", "", "c", "", ""},
  56. {"", "", "c", "", "", "", "", ""},
  57. {"", "", "", "", "", "c", "e", "e"}
  58. },
  59. {
  60. --Level 3
  61. {"", "", "", "", "", "", "", ""},
  62. {"", "", "", "", "", "", "", ""},
  63. {"", "c", "", "", "", "", "", ""},
  64. {"", "", "", "c", "", "", "c", ""},
  65. {"", "", "", "", "", "", "", ""},
  66. {"", "", "", "v", "", "", "c", ""},
  67. {"e", "", "", "c", "", "", "", ""},
  68. {"c", "", "", "", "", "", "", ""}
  69. },
  70. {
  71. --Level 4
  72. {"", "", "", "", "", "c", "", ""},
  73. {"", "c", "c", "", "", "", "", ""},
  74. {"", "", "", "", "", "c", "", ""},
  75. {"", "e", "v", "c", "", "", "", ""},
  76. {"c", "", "", "c", "", "", "", "c"},
  77. {"c", "", "c", "", "", "c", "", ""},
  78. {"", "", "", "", "c", "", "", ""},
  79. {"", "", "", "", "", "", "", ""}
  80. }
  81. }
  82.  
  83. creator_map = {
  84. {"","","","","","",""},
  85. {"","","","","","",""},
  86. {"","","","","","",""},
  87. {"","","","","","",""},
  88. {"","","","","","",""},
  89. {"","","","","","",""},
  90. {"","","","","","",""}
  91. }
  92.  
  93. function read_record()
  94. for i = 1, #map do
  95.     record[i] = tonumber(ini.read("config.ini","level"..i,1)) or 1
  96. end
  97. end
  98.  read_record()
  99.  
  100. --Y->z
  101. --X->x
  102. --Z->y 
  103. exit_coord = {}
  104. map.height = #map[cnv]
  105. map.width = #map[cnv][1]
  106. map.w=10
  107. map.h=5
  108. map.d=10
  109.  
  110. pos={x=-map.width*5,y=0,z=-85}
  111. rot={x=1,y=0,z=0}
  112.  
  113. prism.x = 1
  114. prism.y = 2
  115. prism.x2 = 1
  116. prism.y2 = 1
  117. prism.status = "vertical"
  118. list={"vertical","up","down","right","left"}
  119.  
  120.  
  121. function level_creator()
  122.  
  123. currentmodel = "cube"
  124. while true do
  125. --prism.status=list[c]
  126. controls.read()
  127.  
  128. sel.move()
  129. blit_creator_map()
  130. screen.print(425,5,"@"..screen.fps(),0.77,color.new(255,255,0),color.new(0,0,0))
  131.  
  132. screen.print(5,5,"POS: ".." x:"..sel.x.." y:"..sel.y)
  133.  
  134. _G[currentmodel].obj:position(0,0,0)
  135.  
  136.  
  137. if controls.press("cross") then
  138.     if currentmodel == "cube" then
  139.         creator_map[sel.y][sel.x] = "c"
  140.     end
  141.  
  142. end
  143.  
  144. if controls.press("triangle") then
  145.     str = ""
  146.     if os.message("¿Deseas guardar el nivel?",1)== 1 then
  147.         for y = 1, #creator_map do
  148.             if y < #creator_map then
  149.                 str = str..string.implode(creator_map[y],"|X|").."|Y|"
  150.             else   
  151.                 str = str..string.implode(creator_map[y],"|X|")
  152.             end
  153.         end
  154.         ini.write("levels.ini","1",str)
  155.     end
  156. end
  157. if controls.press("square") then
  158.     str = ini.read("levels.ini","1","")
  159.  
  160.         for y = 1, #creator_map do
  161.             if y < #creator_map then
  162.                 str = str..string.implode(creator_map[y],"|X|").."|Y|"
  163.             else   
  164.                 str = str..string.implode(creator_map[y],"|X|")
  165.             end
  166.         end
  167.        
  168. end
  169.  
  170. if controls.start() then
  171.     --POS
  172.     if controls.up() then pos.y = pos.y+0.5 end
  173.     if controls.down() then pos.y = pos.y-0.5 end
  174.     if controls.left() then pos.x = pos.x-0.5 end
  175.     if controls.right() then pos.x = pos.x+0.5 end
  176.     if controls.l() then pos.z = pos.z-0.5 end
  177.     if controls.r() then pos.z = pos.z+0.5 end
  178.     --ROT
  179.     if controls.triangle() then rot.y = rot.y+0.05 end
  180.     if controls.cross() then rot.y = rot.y-0.05 end
  181.     if controls.square() then rot.x = rot.x-0.05 end
  182.     if controls.circle() then rot.x = rot.x+0.05 end
  183.     if math.abs(controls.analogy())> 50 then rot.x = rot.x+controls.analogy()/2000 end
  184. end
  185.  
  186. screen.print(240-screen.textwidth("Level creator",0.9)/2,5,"Level creator",0.9,color.new(255,0,0),color.new(255,255,0))
  187.  
  188.  
  189. if controls.select() then a() end
  190. if controls.start() and controls.l() and controls.r() then break end
  191. screen.flip()
  192. end
  193. end
  194.  
  195. function sel.move()
  196. if controls.press("down") then
  197.         sel.y = sel.y+1 if sel.y > #creator_map then sel.y = 1 end
  198. end
  199. if controls.press("up") then
  200.  
  201.         sel.y = sel.y-1 if sel.y < 1 then sel.y = #creator_map end
  202. end
  203. if controls.press("right") then
  204.         sel.x = sel.x+1 if sel.x > #creator_map[1] then sel.x = 1 end
  205. end
  206. if controls.press("left") then
  207.         sel.x = sel.x-1 if sel.x < 1 then sel.x = #creator_map[1] end
  208. end
  209. end
  210.  
  211.  
  212. function blit_creator_map()
  213.     sel2.rot = sel2.rot+0.03
  214.     bg:blit(0,0)
  215.     local depth = 0
  216.     local p={x=0,y=0,z=0}
  217.     local r={x=0,y=0,z=0}
  218.     local sp = {x=0,y=0,z=0}
  219.     local sr = {x=0,y=0,z=0}
  220.     local ny = map.height/2
  221.         for y = 1, #creator_map do
  222.             for x = 1, #creator_map[y] do  
  223.                 --Calculate the position of empty models
  224.                     p.x = pos.x +((x-1)*map.w)
  225.                     p.y = pos.y + math.sin(-rot.x)*(y-ny)*map.w
  226.                     p.z = pos.z + math.cos(-rot.x)*(y-ny)*map.w
  227.                 --Blit the empty models
  228.                     floor.obj:rotation(rot.x ,rot.y, rot.z)
  229.                     floor.obj:position(p.x, p.y, p.z)                              
  230.                     floor.obj:blit()                           
  231.                     if creator_map[y][x] != "" then
  232.                         if creator_map[y][x] == "c" then
  233.                             cube.obj:position(p.x,p.y+math.sin(1.57-rot.x)*5,p.z+math.cos(1.57-rot.x)*5)
  234.                             cube.obj:rotation(rot.x,rot.y,rot.z)
  235.                             cube.obj:blit()
  236.                         elseif creator_map[y][x] == "e" then
  237.                             exit.obj:position(p.x,p.y+math.sin(1.57-rot.x)*5,p.z+math.cos(1.57-rot.x)*5)
  238.                             exit.obj:rotation(rot.x,rot.y,rot.z)
  239.                             exit.obj:blit()    
  240.                         end
  241.                     end
  242.                     if x == sel.x and y == sel.y then
  243.                         sel.obj:rotation(rot.x,rot.y,rot.z)
  244.                         sel.obj:position(pos.x +((x-0.5)*map.w), pos.y + math.sin(-rot.x)*(y-ny-0.5)*map.w,pos.z + math.cos(-rot.x)*(y-ny-0.5)*map.w)
  245.                         sel.obj:blit()
  246.                         sel2.obj:rotation(rot.x,rot.y+sel2.rot,rot.z)
  247.                         sel2.obj:position(pos.x +((x-0.5)*map.w),pos.y + math.sin(-rot.x)*((y-0.5)-ny)*map.w+math.sin(1.57-rot.x)*1, pos.z + math.cos(-rot.x)*((y-0.5)-ny)*map.w+math.cos(1.57-rot.x)*1)
  248.                         sel2.obj:blit()
  249.                     end                
  250.                    
  251.             end
  252.     end
  253.  
  254. end
  255.  
  256.  
  257. function change_level(n)
  258. exit_coord = nil
  259. exit_coord = {}
  260. map.height = #map[n]
  261. map.width = #map[n][1]
  262. for y = 1, map.height do
  263.     for x = 1, map.width do
  264.         if map[n][y][x] == "e" then
  265.             table.insert(exit_coord,{x=x,y=y})
  266.         elseif map[n][y][x] == "v" then
  267.             prism.x = x
  268.             prism.y= y
  269.             prism.status="vertical"
  270.         elseif map[n][y][x] == "r" then
  271.             prism.x = x
  272.             prism.y= y
  273.             prism.status="right"
  274.         elseif map[n][y][x] == "l" then
  275.             prism.x = x
  276.             prism.y= y
  277.             prism.status="left"
  278.         elseif map[n][y][x] == "u" then
  279.             prism.x = x
  280.             prism.y= y
  281.             prism.status="up"
  282.         elseif map[n][y][x] == "d" then
  283.             prism.x = x
  284.             prism.y= y
  285.             prism.status="down"
  286.         end
  287.     end
  288. end
  289. map.height = #map[cnv]
  290. map.width = #map[cnv][1]
  291.  
  292. prism.moves=0
  293. end
  294.  
  295. function level_completed()
  296.     blit_map()
  297.     blit_info()
  298.     screen.flip()  
  299.     if record[cnv] == 0 or  prism.moves < record[cnv] then
  300.         ini.write("config.ini",tostring("level"..cnv),tostring(prism.moves))
  301.     end
  302.     ini.write("config.ini","currentlevel",tostring(cnv))   
  303.     if cnv < #map then
  304.         os.message(_level_completed)
  305.         cnv = cnv+1
  306.         change_level(cnv)
  307.     else
  308.         if os.message(_congrats,1) == 1 then
  309.             cnv = 1
  310.             read_record()
  311.             change_level(cnv)
  312.         else
  313.             --os.exit()
  314.             asfbfdhdhrhrehreh()
  315.         end
  316.     end
  317. end
  318.  
  319.  
  320. function check_exit()
  321. if prism.status == "right" then prism.x2 = prism.x+1; prism.y2 = prism.y  end
  322. if prism.status == "left" then prism.x2 = prism.x-1; prism.y2 = prism.y  end
  323. if prism.status == "up" then prism.x2 = prism.x; prism.y2 = prism.y-1  end
  324. if prism.status == "down" then prism.x2 = prism.x; prism.y2 = prism.y+1  end
  325.     if #exit_coord == 1 then       
  326.         if prism.status == "vertical" and exit_coord[1].x == prism.x and exit_coord[1].y == prism.y then
  327.             level_completed()
  328.         end
  329.     elseif #exit_coord == 2 and prism.status != "vertical" then
  330.         if (exit_coord[1].x == prism.x and exit_coord[1].y == prism.y and exit_coord[2].x == prism.x2 and exit_coord[2].y == prism.y2) or
  331.         (exit_coord[2].x == prism.x and exit_coord[2].y == prism.y and exit_coord[1].x == prism.x2 and exit_coord[1].y == prism.y2) then
  332.             level_completed()
  333.         end
  334.     end
  335.  
  336. end
  337.  
  338. function blit_map()
  339.     bg:blit(0,0)
  340.     local depth = 0
  341.     local p={x=0,y=0,z=0}
  342.     local r={x=0,y=0,z=0}
  343.     local sp = {x=0,y=0,z=0}
  344.     local sr = {x=0,y=0,z=0}
  345.     local ny = map.height/2
  346.         for y = 1, map.height do
  347.             for x = 1, map.width do
  348.                 --Calculate the position of empty models
  349.                     p.x = pos.x +((x-1)*map.w)
  350.                     p.y = pos.y + math.sin(-rot.x)*(y-ny)*map.w
  351.                     p.z = pos.z + math.cos(-rot.x)*(y-ny)*map.w
  352.                 --Blit the empty models
  353.                     floor.obj:rotation(rot.x ,rot.y, rot.z)
  354.                     floor.obj:position(p.x, p.y, p.z)                              
  355.                     floor.obj:blit()   
  356.                     if x== prism.x and y == prism.y then                   
  357.                         if prism.status == "up" then
  358.                             sp.x = p.x
  359.                             sp.y = p.y+math.sin(1.57-rot.x)*15
  360.                             sp.z = p.z+math.cos(1.57-rot.x)*15
  361.                             sr.x = rot.x-1.57
  362.                             sr.y = rot.y
  363.                             sr.z = rot.z
  364.                         elseif prism.status == "down" then
  365.                             sp.x = p.x
  366.                             sp.y = pos.y + math.sin(-rot.x)*((y-1)-ny)*map.w+math.sin(1.57-rot.x)*5
  367.                             sp.z = pos.z + math.cos(-rot.x)*((y-1)-ny)*map.w+math.cos(1.57-rot.x)*5
  368.                             sr.x = rot.x+1.57
  369.                             sr.y = rot.y
  370.                             sr.z = rot.z
  371.                         elseif prism.status == "right" then
  372.                             sp.x = p.x
  373.                             sp.y = pos.y+ math.sin(-rot.x)*((y-1)-ny)*map.w+math.sin(1.57-rot.x)*15
  374.                             sp.z = pos.z + math.cos(-rot.x)*((y-1)-ny)*map.w+math.cos(1.57-rot.x)*15
  375.                             sr.x = rot.x-1.57
  376.                             sr.y = rot.y
  377.                             sr.z = rot.z-1.57
  378.                         elseif prism.status == "left" then
  379.                             sp.x = pos.x +(x*map.w)
  380.                             sp.y = p.y+math.sin(1.57-rot.x)*15
  381.                             sp.z = p.z+math.cos(1.57-rot.x)*15
  382.                             sr.x = rot.x-1.57
  383.                             sr.y = rot.y
  384.                             sr.z = rot.z+1.57                  
  385.                         elseif prism.status == "vertical" then
  386.                             sp.x = p.x
  387.                             sp.y = p.y+math.sin(1.57-rot.x)*5
  388.                             sp.z = p.z+math.cos(1.57-rot.x)*5
  389.                             sr.x = rot.x
  390.                             sr.y = rot.y
  391.                             sr.z = rot.z
  392.                         end
  393.                         prism.obj:rotation(sr.x,sr.y,sr.z)
  394.                         prism.obj:position(sp.x,sp.y,sp.z)
  395.                         prism.obj:blit()
  396.                        
  397.                     end
  398.                     if map[cnv][y][x] != "" then
  399.                         if map[cnv][y][x] == "c" then
  400.                             cube.obj:position(p.x,p.y+math.sin(1.57-rot.x)*5,p.z+math.cos(1.57-rot.x)*5)
  401.                             cube.obj:rotation(rot.x,rot.y,rot.z)
  402.                             cube.obj:blit()
  403.                         elseif map[cnv][y][x] == "e" then
  404.                             exit.obj:position(p.x,p.y+math.sin(1.57-rot.x)*5,p.z+math.cos(1.57-rot.x)*5)
  405.                             exit.obj:rotation(rot.x,rot.y,rot.z)
  406.                             exit.obj:blit()    
  407.                         end
  408.                     end
  409.             end
  410.     end
  411.  
  412. end
  413.  
  414. function xy(y,x)
  415.     if x >0 and y > 0 and x <= map.width and y<=map.height then
  416.         return map[cnv][y][x]
  417.     else
  418.         return "c"
  419.     end
  420. end
  421.  
  422. function prism.move()
  423. if controls.press("down") then
  424.     if prism.status == "vertical" then
  425.         if xy(prism.y +1,prism.x) != "c" and xy(prism.y +2,prism.x) != "c" then
  426.             prism.y = prism.y+1
  427.             prism.status = "down"
  428.             prism.moves = prism.moves+1
  429.         end
  430.     elseif prism.status == "up" then
  431.         if xy(prism.y +1,prism.x) != "c" then
  432.             prism.y = prism.y+1
  433.             prism.status = "vertical"  
  434.             prism.moves = prism.moves+1
  435.         end
  436.     elseif prism.status == "down" then
  437.         if xy(prism.y +1,prism.x) != "c" and xy(prism.y +2,prism.x) != "c" then
  438.             prism.y = prism.y+2
  439.             prism.status = "vertical"  
  440.             prism.moves = prism.moves+1
  441.         end
  442.     elseif prism.status == "right" then
  443.         if xy(prism.y +1,prism.x) != "c" and xy(prism.y +1,prism.x+1) != "c" then
  444.             prism.y = prism.y+1
  445.             prism.moves = prism.moves+1
  446.         end
  447.     elseif prism.status == "left" then
  448.         if xy(prism.y +1,prism.x) != "c" and xy(prism.y +1,prism.x-1) != "c" then
  449.             prism.y = prism.y+1
  450.             prism.moves = prism.moves+1
  451.         end
  452.     end
  453.     check_exit()
  454. end
  455.  
  456. if controls.press("up") then
  457.     if prism.status == "vertical" then
  458.         if xy(prism.y -1,prism.x) != "c" and xy(prism.y -2,prism.x) != "c" then
  459.             prism.y = prism.y-1
  460.             prism.status = "up"
  461.             prism.moves = prism.moves+1        
  462.         end
  463.     elseif prism.status == "up" then
  464.         if xy(prism.y -1,prism.x) != "c" and xy(prism.y -2,prism.x) != "c" then
  465.             prism.y = prism.y-2
  466.             prism.status = "vertical"  
  467.             prism.moves = prism.moves+1
  468.         end
  469.     elseif prism.status == "down" then
  470.         if xy(prism.y -1,prism.x) != "c" then
  471.             prism.y = prism.y-1
  472.             prism.status = "vertical"
  473.             prism.moves = prism.moves+1        
  474.         end
  475.     elseif prism.status == "right" then
  476.         if xy(prism.y -1,prism.x) != "c" and xy(prism.y -1,prism.x+1) != "c" then
  477.             prism.y = prism.y-1
  478.             prism.moves = prism.moves+1
  479.         end
  480.     elseif prism.status == "left" then
  481.         if xy(prism.y -1,prism.x) != "c" and xy(prism.y -1,prism.x-1) != "c" then
  482.             prism.y = prism.y-1
  483.             prism.moves = prism.moves+1
  484.         end
  485.     end
  486.     check_exit()
  487. end
  488.  
  489. if controls.press("right") then
  490.     if prism.status == "vertical" then
  491.         if xy(prism.y ,prism.x+1) != "c" and xy(prism.y ,prism.x+2) != "c" then
  492.             prism.x = prism.x+1
  493.             prism.status = "right"
  494.             prism.moves = prism.moves+1        
  495.         end
  496.     elseif prism.status == "up" then
  497.         if xy(prism.y ,prism.x+1) != "c" and xy(prism.y-1 ,prism.x+1) != "c" then
  498.             prism.x = prism.x+1
  499.             prism.moves = prism.moves+1
  500.         end
  501.     elseif prism.status == "down" then
  502.         if xy(prism.y ,prism.x+1) != "c" and xy(prism.y+1 ,prism.x+1) != "c" then
  503.             prism.x = prism.x+1
  504.             prism.moves = prism.moves+1
  505.         end
  506.     elseif prism.status == "right" then
  507.         if xy(prism.y ,prism.x+1) != "c" and xy(prism.y ,prism.x+2) != "c" then
  508.             prism.x = prism.x+2
  509.             prism.status = "vertical"
  510.             prism.moves = prism.moves+1
  511.         end
  512.     elseif prism.status == "left" then
  513.         if xy(prism.y ,prism.x+1) != "c" then
  514.             prism.x = prism.x+1
  515.             prism.status = "vertical"
  516.             prism.moves = prism.moves+1
  517.         end
  518.     end
  519.     check_exit()
  520. end
  521.  
  522. if controls.press("left") then
  523.     if prism.status == "vertical" then
  524.         if xy(prism.y ,prism.x-1) != "c" and xy(prism.y ,prism.x-2) != "c" then
  525.             prism.x = prism.x-1
  526.             prism.status = "left"
  527.             prism.moves = prism.moves+1        
  528.         end
  529.     elseif prism.status == "up" then
  530.         if xy(prism.y ,prism.x-1) != "c" and xy(prism.y-1 ,prism.x-1) != "c" then
  531.             prism.x = prism.x-1
  532.             prism.moves = prism.moves+1
  533.         end
  534.     elseif prism.status == "down" then
  535.         if xy(prism.y ,prism.x-1) != "c" and xy(prism.y+1 ,prism.x-1) != "c" then
  536.             prism.x = prism.x-1
  537.             prism.moves = prism.moves+1
  538.         end
  539.     elseif prism.status == "right" then
  540.         if xy(prism.y ,prism.x-1) != "c" then
  541.             prism.x = prism.x-1
  542.             prism.status = "vertical"
  543.             prism.moves = prism.moves+1
  544.         end
  545.     elseif prism.status == "left" then
  546.         if xy(prism.y ,prism.x-2) != "c" then
  547.             prism.x = prism.x-2
  548.             prism.status = "vertical"
  549.             prism.moves = prism.moves+1
  550.         end
  551.     end
  552.     check_exit()
  553. end
  554. end
  555.  
  556. function blit_info()
  557. screen.print(5,5,string.format(_level,cnv)..", "..string.format(_moves,prism.moves),0.77,color.new(255,0,0),color.new(0,255,0))
  558. screen.print(425,5,"@"..screen.fps(),0.77,color.new(255,255,0),color.new(0,0,0))
  559. screen.print(405,255,"R: Reset",0.77,color.new(0,255,0),color.new(0,0,0))
  560. screen.print(5,25,string.format(_record,record[cnv]),0.77,color.new(255,0,0),color.new(0,255,0))
  561. end
  562.  
  563. change_level(cnv)
  564.  
  565. level_creator()
  566. while true do
  567. controls.read()
  568.  
  569. if controls.start() then
  570.     --POS
  571.     if controls.up() then pos.y = pos.y+0.5 end
  572.     if controls.down() then pos.y = pos.y-0.5 end
  573.     if controls.left() then pos.x = pos.x-0.5 end
  574.     if controls.right() then pos.x = pos.x+0.5 end
  575.     if controls.l() then pos.z = pos.z-0.5 end
  576.     if controls.r() then pos.z = pos.z+0.5 end
  577.     --ROT
  578.     if controls.triangle() then rot.y = rot.y+0.05 end
  579.     if controls.cross() then rot.y = rot.y-0.05 end
  580.     if controls.square() then rot.x = rot.x-0.05 end
  581.     if controls.circle() then rot.x = rot.x+0.05 end
  582.     if math.abs(controls.analogy())> 50 then rot.x = rot.x+controls.analogy()/2000 end
  583. end
  584.  
  585. if controls.press("r") then --Reset level
  586.     change_level(cnv)
  587. end
  588.  
  589.  
  590. prism.move()
  591. blit_map()
  592.  
  593.  
  594. blit_info()
  595.  
  596. if controls.select() then a() end
  597. screen.flip()
  598. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement