Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monSide = "back"
- mon = peripheral.wrap(monSide)
- local xMax,yMax = mon.getSize()
- rs.setOutput("bottom", false)
- i=1
- function hintergrund()
- mon.setBackgroundColor(colors.cyan)
- for b = 0,xMax,1 do
- for i = 0,yMax,1 do
- mon.setCursorPos(b,i)
- mon.write(" ")
- end
- end
- end
- function animation()
- mon.setBackgroundColor(colors.white)
- g = -2
- for l = 1,8,1 do
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(l,2)
- mon.write(" ")
- sleep(0.1)
- mon.setBackgroundColor(coloranimation)
- mon.setCursorPos(g,2)
- mon.write(" ")
- g = g+1
- mon.setBackgroundColor(colors.white)
- end
- --S
- for l = 8,6,-1 do
- mon.setCursorPos(l,2)
- mon.write(" ")
- sleep(0.1)
- end
- mon.setCursorPos(6,3)
- mon.write(" ")
- sleep(0.1)
- for l = 6,8,1 do
- mon.setCursorPos(l,4)
- mon.write(" ")
- sleep(0.1)
- end
- mon.setCursorPos(8,5)
- mon.write(" ")
- sleep(0.1)
- for l = 8,6,-1 do
- mon.setCursorPos(l,6)
- mon.write(" ")
- sleep(0.1)
- end
- --N
- for l = 6,2,-1 do
- mon.setCursorPos(10,l)
- mon.write(" ")
- sleep(0.1)
- end
- mon.setCursorPos(11,2)
- g = 11
- for l = 3,5,1 do
- mon.setCursorPos(g,l)
- mon.write(" ")
- g=g+1
- sleep(0.1)
- end
- for l = 6,2,-1 do
- mon.setCursorPos(14,l)
- mon.write(" ")
- sleep(0.1)
- end
- --A
- for l = 6,3,-1 do
- mon.setCursorPos(16,l)
- mon.write(" ")
- sleep(0.1)
- end
- for l = 17,18,1 do
- mon.setCursorPos(l,2)
- mon.write(" ")
- sleep(0.1)
- end
- for l = 3,6,1 do
- mon.setCursorPos(19,l)
- mon.write(" ")
- sleep(0.1)
- end
- for l = 17,18,1 do
- mon.setCursorPos(l,4)
- mon.write(" ")
- sleep(0.1)
- end
- --K
- for l = 6,2,-1 do
- mon.setCursorPos(21,l)
- mon.write(" ")
- sleep(0.1)
- end
- g = 4
- for l = 22,24,1 do
- mon.setCursorPos(l,g)
- mon.write(" ")
- g=g-1
- sleep(0.1)
- end
- g = 5
- for l = 23,24,1 do
- mon.setCursorPos(l,g)
- mon.write(" ")
- g=g+1
- sleep(0.1)
- end
- --E
- for l = 6,2,-1 do
- mon.setCursorPos(26,l)
- mon.write(" ")
- sleep(0.1)
- end
- for g = 2,6,2 do
- for l = 27,28,1 do
- mon.setCursorPos(l,g)
- mon.write(" ")
- sleep(0.1)
- end
- end
- g = 27
- for l = 29,xMax,1 do
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(l,6)
- mon.write(" ")
- sleep(0.1)
- if g >= 29 then
- mon.setBackgroundColor(coloranimation)
- mon.setCursorPos(g,6)
- mon.write(" ")
- end
- g=g+1
- end
- snake=xMax-5
- for l = xMax,snake,-1 do
- mon.setBackgroundColor(coloranimation)
- mon.setCursorPos(l,6)
- mon.write(" ")
- end
- end
- function steuerung()
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(60,15)
- mon.write("W")
- mon.setCursorPos(57,17)
- mon.write("A")
- mon.setCursorPos(60,17)
- mon.write("+")
- mon.setCursorPos(63,17)
- mon.write("S")
- mon.setCursorPos(60,19)
- mon.write("D")
- end
- function hauptmenu()
- coloranimation = colors.cyan
- hintergrund()
- animation()
- steuerung()
- mon.setBackgroundColor(colors.cyan)
- mon.setTextScale(1)
- mon.setTextColor(colors.white)
- mon.setCursorPos(7,8)
- mon.write("[Spiel starten]")
- sleep(0.5)
- mon.setCursorPos(7,9)
- mon.write("[Optionen]")
- sleep(0.5)
- mon.setCursorPos(7,10)
- mon.write("[Anleitung]")
- sleep(0.5)
- mon.setCursorPos(7,11)
- mon.write("[Beenden]")
- end
- hauptmenu()
- os.loadAPI("ocs/apis/sensor")
- proximity = sensor.wrap("top")
- while true do
- player = "warte auf Spieler..."
- sleep(0.2)
- targets = proximity.getTargets()
- for k,v in pairs(targets) do
- if v.Name == "Player"
- and v.Position.X<=3 and v.Position.X>=-3
- and v.Position.Z<=9 and v.Position.Z>=3
- and v.Position.Y>=-3 and v.Position.Y<=4
- then
- player = k
- H = " "
- --Springen
- if v.Name == "Player" and
- v.Position.X>=-0.5 and v.Position.X <=0.5 and
- v.Position.Z>=5.5 and v.Position.Z<=6.5 and
- v.Position.Y>=-0.5 and v.Position.Y<=2 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.black)
- mon.setCursorPos(60,17)
- mon.write("+")
- H = "+"
- print("+")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(60,17)
- mon.write("+")
- end
- --W
- if v.Name == "Player" and
- v.Position.X>=-0.5 and v.Position.X <=0.5 and
- v.Position.Z>=4.5 and v.Position.Z<=5.5 and
- v.Position.Y>=-3 and v.Position.Y<=4 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.blue)
- mon.setCursorPos(60,15)
- mon.write("W")
- H = "W"
- print("W")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(60,15)
- mon.write("W")
- end
- --A
- if v.Name == "Player" and
- v.Position.X>=-1.5 and v.Position.X <=-0.5 and
- v.Position.Z>=5.5 and v.Position.Z<=6.5 and
- v.Position.Y>=-3 and v.Position.Y<=4 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.red)
- mon.setCursorPos(57,17)
- mon.write("A")
- H = "A"
- print("A")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(57,17)
- mon.write("A")
- end
- --S
- if v.Name == "Player" and
- v.Position.X>=0.5 and v.Position.X <=1.5 and
- v.Position.Z>=5.5 and v.Position.Z<=6.5 and
- v.Position.Y>=-3 and v.Position.Y<=4 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.lime)
- mon.setCursorPos(63,17)
- mon.write("S")
- H = "S"
- print("S")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(63,17)
- mon.write("S")
- end
- --D
- if v.Name == "Player" and
- v.Position.X>=-0.5 and v.Position.X <=0.5 and
- v.Position.Z>=6.5 and v.Position.Z<=7.5 and
- v.Position.Y>=-3 and v.Position.Y<=4 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.yellow)
- mon.setCursorPos(60,19)
- mon.write("D")
- H = "D"
- print("D")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(60,19)
- mon.write("D")
- end
- if H == "W" then
- i=i-1
- sleep(0.6)
- end
- if H == "D" then
- i=i+1
- sleep(0.6)
- end
- print(i)
- if i == 0 then
- i = 4
- end
- if i == 5 then
- i = 1
- end
- if i == 1 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.red)
- mon.setCursorPos(7,8)
- mon.write("[Spiel starten]")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(7,8)
- mon.write("[Spiel starten]")
- end
- if i == 1 and H == "+" then
- print("Spiel starten")
- shell.run("snake")
- end
- if i == 2 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.red)
- mon.setCursorPos(7,9)
- mon.write("[Optionen]")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(7,9)
- mon.write("[Optionen]")
- end
- if i == 2 and H == "+" then
- print("Optionen")
- end
- if i == 3 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.red)
- mon.setCursorPos(7,10)
- mon.write("[Anleitung]")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(7,10)
- mon.write("[Anleitung]")
- end
- if i == 3 and H == "+" then
- print("Anleitung")
- mon.clear()
- mon.setBackgroundColor(colors.black)
- for b = 0,xMax,1 do
- for i = 0,yMax,1 do
- mon.setCursorPos(b,i)
- mon.write(" ")
- end
- end
- coloranimation = colors.black
- animation()
- mon.setTextColor(colors.white)
- mon.setCursorPos(7,8)
- mon.write("Anleitung:")
- sleep(10)
- hauptmenu()
- end
- if i == 4 then
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.red)
- mon.setCursorPos(7,11)
- mon.write("[Beenden]")
- else
- mon.setBackgroundColor(colors.cyan)
- mon.setTextColor(colors.white)
- mon.setCursorPos(7,11)
- mon.write("[Beenden]")
- end
- if i == 4 and H == "+" then
- print("Beenden")
- os.reboot()
- end
- end
- end
- for l = 1,xMax,1 do
- mon.setCursorPos(l,1)
- mon.setBackgroundColor(colors.cyan)
- mon.write(" ")
- end
- mon.setCursorPos(1,1)
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- mon.write(player)
- end
Add Comment
Please, Sign In to add comment