Advertisement
Guest User

casino

a guest
Apr 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.81 KB | None | 0 0
  1. local component = require("component") local gpu = component.gpu local pull_e = require('event').pull local W, H = gpu.getResolution() local math = require("math") local redstone = component.redstone local sides = require("sides")
  2.  
  3. function menu() gpu.setBackground(0x000000) gpu.setForeground(0x2F4F4F) gpu.fill(1,1,W,H," ") gpu.fill(1,1,1,H,"|") gpu.fill(2,1,1,H,"|") gpu.fill(W,1,W,H,"|") gpu.fill(W-1,1,W,H,"|") gpu.fill(1,1,W,1,"=") gpu.fill(1,H,W,H,"=") gpu.fill(35,1,2,H,"|") gpu.setForeground(0x4169E1) gpu.set(3,2,"что бы начать игру, нажми старт") gpu.set(3,4,"Выпало 3 одинаковых, ты выйграл")gpu.set(3,6,"Если нет одинаковых, ты проиграл") end
  4. function one(x,y) gpu.setBackground(0x4169E1) gpu.set(x+2,y," ") gpu.fill(x,y+1,5,1," ") gpu.fill(x+3,y,2,6," ") gpu.setBackground(0x000000) end
  5. function two(x,y) gpu.setBackground(0x800080) gpu.set(x,y+1," ") gpu.fill(x+1,y,4,1," ") gpu.set(x+4,y+1," ") gpu.set(x+3,y+2," ") gpu.set(x+2,y+3," ") gpu.set(x+1,y+4," ") gpu.fill(x,y+5,5,1," ") gpu.setBackground(0x000000) end
  6. function three(x,y) gpu.setBackground(0x008000) gpu.set(x,y+1," ") gpu.fill(x+1,y,3,1," ") gpu.set(x+4,y+1," ") gpu.fill(x+3,y+2,1,2," ") gpu.set(x+4,y+4," ") gpu.fill(x+1,y+5,3,1," ") gpu.set(x,y+4," ") gpu.setBackground(0x000000) end
  7. function four(x,y) gpu.setBackground(0x808000) gpu.fill(x,y,1,3," ") gpu.fill(x,y+2,5,1," ") gpu.fill(x+4,y,1,6," ") gpu.setBackground(0x000000) end
  8. function five(x,y) gpu.setBackground(0x00FFFF) gpu.fill(x,y,5,1," ") gpu.fill(x,y,1,3," ") gpu.fill(x,y+2,4,1," ") gpu.fill(x+4,y+3,1,2," ") gpu.fill(x,y+5,4,1," ") gpu.setBackground(0x000000) end
  9. function six(x,y) gpu.setBackground(0xFF0000) gpu.fill(x+1,y,4,1," ") gpu.fill(x,y+1,1,4," ") gpu.fill(x+1,y+5,3,1," ") gpu.fill(x+1,y+2,3,1," ") gpu.fill(x+4,y+3,1,2," ") gpu.setBackground(0x000000) end
  10. function seven(x,y) gpu.setBackground(0xFFFF00) gpu.fill(x,y,5,1," ") gpu.fill(x+4,y,1,3," ") gpu.set(x+3,y+3," ") gpu.set(x+2,y+4," ") gpu.set(x+1,y+5," ") gpu.setBackground(0x000000) end
  11. function ramka(x,y) gpu.setBackground(0x2F4F4F) gpu.fill(x,y,10,1," ") gpu.fill(x+9,y,1,10," ") gpu.fill(x,y,1,10," ") gpu.fill(x,y+9,10,1," ") gpu.setBackground(0x000000) end
  12. function start() gpu.setBackground(0x2F4F4F) gpu.fill(4,25,29,3," ") gpu.set(16,26,"СТАРТ") gpu.setBackground(0x000000) end
  13. function menu1() gpu.fill(1,1,W,H," ") gpu.setBackground(0x2F4F4F) gpu.fill(49,24,54,3," ") gpu.setForeground(0x4169E1) gpu.set(50,25,"Для того что бы начать игру положи 1$ в приобретатель") gpu.setForeground(0xFFFFFF) gpu.setBackground(0x000000) end
  14.  
  15. menu1()
  16.  
  17. while true do
  18. if redstone.getInput(sides.north) > 0 then gpu.fill(1,1,W,H," ")
  19. menu()
  20. start()
  21. ramka(50,14) ramka(80,14) ramka(110,14)
  22. gpu.setForeground(0x800080) gpu.set(50,10,"список призов: нано-шлем, нано-поножи, нано-ботинки, улучшенный нано-жилет, джетпак, энергетический кристалл") gpu.set(50,12,"материя, иридий, ускоритель") local tevent = {pull_e('touch')}
  23. if tevent[3] > 3 and tevent[3] < 33 and tevent[4] > 24 and tevent[4] < 29 then
  24.  for i = 1,10 do local random = math.random(8) if random == 1 then gpu.fill(51,15,8,8," ") one(52,16) end if random == 2 then gpu.fill(51,15,8,8," ") two(52,16) end if random == 3 then gpu.fill(51,15,8,8," ") three(52,16) end if random == 4 then gpu.fill(51,15,8,8," ") four(52,16) end if random == 5 then gpu.fill(51,15,8,8," ") five(52,16) end if random == 6 then gpu.fill(51,15,8,8," ") six(52,16) end if random == 7 then gpu.fill(51,15,8,8," ") seven(52,16) end os.sleep(0.2) end local first = random
  25.  for i = 1,10 do local random = math.random(8) if random == 1 then gpu.fill(81,15,8,8," ") one(82,16) end if random == 2 then gpu.fill(81,15,8,8," ") two(82,16) end if random == 3 then gpu.fill(81,15,8,8," ") three(82,16) end if random == 4 then gpu.fill(81,15,8,8," ") four(82,16) end if random == 5 then gpu.fill(81,15,8,8," ") five(82,16) end if random == 6 then gpu.fill(81,15,8,8," ") six(82,16) end if random == 7 then gpu.fill(81,15,8,8," ") seven(82,16) end os.sleep(0.2) end local second = random
  26.  for i = 1,10 do local random = math.random(8) if random == 1 then gpu.fill(111,15,8,8," ") one(112,16) end if random == 2 then gpu.fill(111,15,8,8," ") two(112,16) end if random == 3 then gpu.fill(111,15,8,8," ") three(112,16) end if random == 4 then gpu.fill(111,15,8,8," ") four(112,16) end if random == 5 then gpu.fill(111,15,8,8," ") five(112,16) end if random == 6 then gpu.fill(111,15,8,8," ") six(112,16) end if random == 7 then gpu.fill(111,15,8,8," ") seven(112,16) end os.sleep(0.2) end local three = random
  27. end
  28.  
  29. if first == second and second == three then redstone.setOutput(sides.top,16) redstone.setOutput(sides.top,0) end os.sleep(3) menu1()
  30. end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement