Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Bdraw(colors.black)
- -- term.setCursorPos(1,1)
- -- term.setTextColor(colors.red)
- -- term.write(Name)
- -- term.setCursorPos(20,1)
- -- term.setTextColor(colors.cyan)
- -- term.write("Name: ")
- -- Name2 = io.read()
- term.setCursorPos(10,4)
- term.setTextColor(colors.yellow)
- term.write("Spiel wird gestartet...")
- term.setCursorPos(1,6)
- term.setTextColor(colors.red)
- -- term.write("Spieler 1: "..Name.." steuert mit Pfeiltasten")
- term.setCursorPos(1,7)
- term.setTextColor(colors.cyan)
- -- term.write("Spieler 2: "..Name2.." steuert mit WASD")
- for b = 5,1,-1 do
- term.setTextColor(colors.orange)
- term.setCursorPos(10,9)
- term.write(b)
- sleep(1)
- end
- -- Bdraw(colors.black)
- xPosition1 = {}
- yPosition1 = {}
- xPosition2 = {}
- yPosition2 = {}
- Pos = 1
- xPos1 = 10
- yPos1 = 15
- xPos2 = 20
- yPos2 = 5
- Richtung1 = 2
- Richtung2 = 4
- while true do
- xPosition1[Pos] = xPos1
- yPosition1[Pos] = yPos1
- xPosition2[Pos] = xPos2
- yPosition2[Pos] = yPos2
- term.setBackgroundColor(colors.red)
- term.setCursorPos(xPos1,yPos1)
- term.write(" ")
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(xPos2,yPos2)
- term.write(" ")
- Timer = os.startTimer(0.2)
- event ,key = os.pullEvent()
- if event == "key" then
- sleep(0.2)
- --oben1
- if key == 200 then
- Richtung1 = 1
- --rechts1
- elseif key == 205 then
- Richtung1 = 2
- --unten1
- elseif key == 208 then
- Richtung1 = 3
- --links1
- elseif key == 203 then
- Richtung1 = 4
- end
- --oben2
- if key == 17 then
- Richtung2 = 1
- --rechts2
- elseif key == 32 then
- Richtung2 = 2
- --unten2
- elseif key == 31 then
- Richtung2 = 3
- --links2
- elseif key == 30 then
- Richtung2 = 4
- end
- end
- if Richtung1 == 1 then
- yPos1 = yPos1-1
- elseif
- Richtung1 == 2 then
- xPos1 = xPos1+1
- elseif
- Richtung1 == 3 then
- yPos1 = yPos1+1
- elseif
- Richtung1 == 4 then
- xPos1 = xPos1-1
- end
- if Richtung2 == 1 then
- yPos2 = yPos2-1
- elseif
- Richtung2 == 2 then
- xPos2 = xPos2+1
- elseif
- Richtung2 == 3 then
- yPos2 = yPos2+1
- elseif
- Richtung2 == 4 then
- xPos2 = xPos2-1
- end
- xMax = 10
- yMax = 20
- Pos = Pos+1
- --for Px = 1,#xPosition1 do
- --if xPos1 == xPosition1[Px] and yPos1 == yPosition1[Px] or xPos1 == xMax+1 or yPos1 == yMax+1 or xPos1 == 0 or yPos1 == 0 then
- --Bdraw(colors.black)
- --term.setCursorPos(7,5)
- --term.write("Spieler 1 verliert")
- --elseif xPos2 == xPosition2[Px] and yPos2 == yPosition2[Px] or xPos2 == xMax+1 or yPos2 == yMax+1 or xPos2 == 0 or yPos2 == 0 then
- --Bdraw(colors.black)
- --term.setCursorPos(7,5)
- --term.write("Spieler 2 verliert")
- --end
- --end
- --sleep(3)
- --os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment