Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("config")
- Menu = {}
- Menu[1] = {3,17,3,5,colors.gray,colors.blue,"Spiel Hosten",false}
- Menu[2] = {3,17,3,5,colors.gray,colors.blue,"Beitreten" ,false}
- Menu[3] = {3,17,3,5,colors.gray,colors.blue,"Menu" ,false}
- local xMax,yMax = term.getSize()
- Pos = 1
- function Background(xP1,xP2,yP1,yP2,col)
- term.setBackgroundColor(col)
- for xPos = xP1,xP2 do
- for yPos = yP1,yP2 do
- term.setCursorPos(xPos,yPos)
- term.write(" ")
- end
- end
- end
- function BackgroundWater(xP1,xP2,yP1,yP2)
- t = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}
- i = 1
- for yPos = yP1,yP2 do
- term.setBackgroundColor(colors.gray)
- if i < 10 then
- term.setCursorPos(2,yPos)
- else
- term.setCursorPos(1,yPos)
- end
- term.write(i)
- i = i+1
- end
- i = 1
- for xPos = xP1,xP2 do
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(xPos,1)
- term.write(t[i])
- i = i+1
- for yPos = yP1,yP2 do
- g = math.random(1,5)
- if g == 1 then
- col = colors.lightBlue
- else
- col = colors.blue
- end
- term.setBackgroundColor(col)
- term.setCursorPos(xPos,yPos)
- term.write(" ")
- end
- end
- end
- Schiffe = {}
- Schiffe[1] = {7,"Flugzeugtraeger" ,false,false}
- Schiffe[2] = {5,"Panzerschiff" ,false,false}
- Schiffe[3] = {5,"Panzerschiff" ,false,false}
- Schiffe[4] = {3,"Zerstoerer" ,false,false}
- Schiffe[5] = {2,"Aufklaerungsboot",false,false}
- while true do
- for x = 1,#Schiffe do
- Schiffe[x][3] = false
- end
- Schiffe[Pos][3] = true
- Background(1,xMax,1,yMax,colors.gray)
- BackgroundWater(3,xMax-23,2,yMax-1)
- Background(xMax-20,xMax-1,2,yMax-1,colors.lightGray)
- b = 0
- for a = 1,#Schiffe do
- if Schiffe[a][4] then
- term.setBackgroundColor(colors.red)
- for i = 0,Schiffe[a][1]-1 do
- if Schiffe[a][7] == "h" then
- term.setCursorPos(Schiffe[a][5]+i,Schiffe[a][6])
- term.write(" ")
- elseif Schiffe[a][7] == "v" then
- term.setCursorPos(Schiffe[a][5],Schiffe[a][6]+i)
- term.write(" ")
- end
- end
- end
- end
- for a = 1,#Schiffe do
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(xMax-19,3+b)
- term.write(Schiffe[a][2])
- term.setCursorPos(xMax-19,4+b)
- if Schiffe[a][3] then
- term.setBackgroundColor(colors.blue)
- elseif Schiffe[a][3] == false then
- term.setBackgroundColor(colors.red)
- end
- if Schiffe[a][4] then
- term.setBackgroundColor(colors.lime)
- end
- if Schiffe[a][4] and Schiffe[a][3] then
- term.setBackgroundColor(colors.yellow)
- end
- for i = 1,Schiffe[a][1] do
- term.write(" ")
- end
- b = b+3
- end
- event,key = os.pullEvent("key")
- for b = 1,#Key do
- if Key[b][2] ~= nil then
- if key == Key[b][2] or key == Key[b][3] then
- if Key[b][1] == "UP" then
- Pos = Pos-1
- elseif Key[b][1] == "DOWN" then
- Pos = Pos+1
- elseif Key[b][1] == "SPACE" then
- g = 0
- for a = 1,#Schiffe do
- if Schiffe[a][4] then
- g = g + 1
- end
- end
- if g == #Schiffe then
- while true do
- Background(1,xMax,1,yMax,colors.gray)
- rednet.open(RedSide)
- Background(2,xMax-1,2,yMax-1)
- term.setTextColor(colors.white)
- for i = 1,#Menu do
- if Menu[i][8] then
- term.setBackgroundColor(Menu[i][6])
- else
- term.setBackgroundColor(Menu[i][5])
- end
- end
- for xPos = Menu[i][1],Menu[i][2] do
- for yPos = Menu[i][3],Menu[i][4] do
- term.setCursorPos(xPos,yPos)
- term.write(" ")
- end
- end
- term.setCursorPos(1+Menu[i][1]+((Menu[i][2]-Menu[i][1])/2)-#Menu[i][8]/2,Menu[i][3]+((Menu[i][4]-Menu[i][3])/2))
- term.write(Menu[i][8])
- end
- event,k = os.pullEvent("key")
- for l = 1,#Key do
- if Key[b][2] ~= nil then
- if k == Key[b][2] or Key[b][3] then
- if Key[b][1] == "UP" then
- P = P - 1
- elseif Key[b][1] == "DOWN" then
- P = P + 1
- elseif Key[b][1] == "BACK" then
- os.reboot()
- elseif Key[b][1] == "CONFIRM" then
- end
- end
- end
- end
- end
- elseif Key[b][1] == "CONFIRM" then
- xP = 3
- yP = 2
- L = Schiffe[Pos][1]
- A = "h"
- br = false
- while true do
- xMi = 3
- yMi = 2
- if A == "h" then
- xMa = xMax-22-L
- yMa = yMax-1
- else
- xMa = xMax-23
- yMa = yMax-L
- end
- if xP > xMa then
- xP = xMa
- elseif xP < xMi then
- xP = xMi
- end
- if yP > yMa then
- yP = yMa
- elseif yP < yMi then
- yP = yMi
- end
- term.setBackgroundColor(colors.red)
- for i = 0,L-1 do
- if A == "h" then
- term.setCursorPos(xP+i,yP)
- term.write(" ")
- elseif A == "v" then
- term.setCursorPos(xP,yP+i)
- term.write(" ")
- end
- end
- for a = 1,#Schiffe do
- if Schiffe[a][4] then
- term.setBackgroundColor(colors.gray)
- for i = 0,Schiffe[a][1]-1 do
- if Schiffe[a][7] == "h" then
- term.setCursorPos(Schiffe[a][5]+i,Schiffe[a][6])
- term.write(" ")
- elseif Schiffe[a][7] == "v" then
- term.setCursorPos(Schiffe[a][5],Schiffe[a][6]+i)
- term.write(" ")
- end
- end
- end
- end
- event,key = os.pullEvent("key")
- for b = 1,#Key do
- if Key[b][2] ~= nil then
- if key == Key[b][2] or key == Key[b][3] then
- if Key[b][1] == "UP" then
- yP = yP-1
- elseif Key[b][1] == "DOWN" then
- yP = yP+1
- elseif Key[b][1] == "LEFT" then
- xP = xP-1
- elseif Key[b][1] == "RIGHT" then
- xP = xP+1
- elseif Key[b][1] == "BACK" then
- br = true
- elseif Key[b][1] == "CONFIRM" then
- Schiffe[Pos][4] = true
- br = true
- Schiffe[Pos][5] = xP
- Schiffe[Pos][6] = yP
- Schiffe[Pos][7] = A
- elseif Key[b][1] == "Q" then
- if A == "h" then
- A = "v"
- else
- A = "h"
- end
- end
- end
- end
- end
- BackgroundWater(3,xMax-23,2,yMax-1)
- if br then
- break
- end
- end
- --Schiffe[Pos][4] = true
- end
- end
- end
- end
- if Pos > #Schiffe then
- Pos = 1
- elseif Pos < 1 then
- Pos = #Schiffe
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement