Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mpa = false
- if peripheral.isPresent("top") and peripheral.getType("top") == "modem" then
- print("Modem found; you can play multiplayer!")
- rednet.open("top")
- mpa = true
- elseif peripheral.isPresent("back") and peripheral.getType("back") == "modem" then
- print("Modem found; you can play multiplayer!")
- rednet.open("back")
- mpa = true
- elseif peripheral.isPresent("right") and peripheral.getType("right") == "modem" then
- print("Modem found; you can play multiplayer!")
- rednet.open("right")
- mpa = true
- elseif peripheral.isPresent("left") and peripheral.getType("left") == "modem" then
- print("Modem found; you can play multiplayer!")
- rednet.open("left")
- mpa = true
- else
- print("No modems found; multiplayer is unavailable")
- end
- if mpa then
- spormp = read("SP or MP? ")
- if spormp == "MP" or spormp == "Mp" or spormp == "mp" then
- mpa = true
- else
- mpa = false
- end
- end
- sleep(1)
- shell.run("rm mainimg")
- shell.run("pastebin get s0K2qDds mainimg")
- shell.run("rm menuimg")
- shell.run("pastebin get s0K2qDds menuing")
- running = true
- ptmainimg = "mainimg"
- ptmenuimg = "menuing"
- charge = 1
- maxcharge = 16
- lives = 3
- score = 0
- gs = 1
- ex = 0
- ey = 0
- bx = 0
- by = 0
- ba = false
- et = 0
- img = paintutils.loadImage(ptmainimg)
- paintutils.drawImage(img,1,1)
- while running == true do
- tid = os.startTimer(0.25)
- evt, v1, v2, v3 = os.pullEvent()
- if gs == 0 then
- paintutils.drawPixel(2, charge+1, 44)
- paintutils.drawPixel(3, charge+1, 44)
- if charge >= maxcharge then
- ready = true
- else
- charge = charge + 1
- end
- if evt == "rednet_message" then
- msg1 = v2
- msg2 = v2
- typeofcmd = string.sub(msg1, 1, 1)
- if typeofcmd == "1" then
- ey = tonumber(string.sub(msg2, 2, 3))
- print(ey)
- ey = 2
- ex = 4
- end
- elseif evt == "mouse_click" then
- if charge == maxcharge then
- paintutils.drawLine(2, 2, 2, 17, 64)
- paintutils.drawLine(3, 2, 3, 17, 64)
- charge = 1
- paintutils.drawPixel(bx, by, 55)
- bx = 4
- if v3 < 2 then
- v3 = 3
- end
- if v3 > 17 then
- v3 = 17
- end
- rednet.broadcast("1"..tostring(v3))
- by = v3
- end
- end
- v1 = v1 + 1
- if v1 == tid then
- term.setCursorPos(2,1)
- write("Lives: ")
- i = 0
- while i < lives do
- write("*")
- i = i + 1
- end
- while i < 5 do
- write(" ")
- i = i + 1
- end
- term.setCursorPos(35,1)
- write("Score: "..tostring(score))
- et = et + 1
- if et > 45 then
- et = 0
- ey = math.random(2,17)
- ex = 48
- end
- if ex == 4 then
- lives = lives - 1
- ex = 0
- ey = 0
- end
- if ey == by then
- if ex == bx or ex == bx+1 or ex == bx-1 then
- score = score + 1
- paintutils.drawPixel(ex, ey, 64)
- sleep(0.3)
- paintutils.drawPixel(ex, ey+1, 2)
- paintutils.drawPixel(ex, ey-1, 2)
- paintutils.drawPixel(ex+1, ey, 2)
- paintutils.drawPixel(ex-1, ey, 2)
- sleep(0.3)
- paintutils.drawPixel(ex, ey+2, 2)
- paintutils.drawPixel(ex, ey-2, 2)
- paintutils.drawPixel(ex+2, ey, 2)
- paintutils.drawPixel(ex-2, ey, 2)
- paintutils.drawPixel(ex-1, ey+1, 2)
- paintutils.drawPixel(ex+1, ey-1, 2)
- paintutils.drawPixel(ex-1, ey-1, 2)
- paintutils.drawPixel(ex+1, ey+1, 2)
- sleep(0.3)
- paintutils.drawPixel(ex, ey, 30)
- sleep(0.3)
- paintutils.drawPixel(ex, ey+1, 30)
- paintutils.drawPixel(ex, ey-1, 30)
- paintutils.drawPixel(ex+1, ey, 30)
- paintutils.drawPixel(ex-1, ey, 30)
- sleep(0.3)
- paintutils.drawPixel(ex, ey+2, 30)
- paintutils.drawPixel(ex, ey-2, 30)
- paintutils.drawPixel(ex+2, ey, 30)
- paintutils.drawPixel(ex-2, ey, 30)
- paintutils.drawPixel(ex-1, ey+1, 30)
- paintutils.drawPixel(ex+1, ey-1, 30)
- paintutils.drawPixel(ex-1, ey-1, 30)
- paintutils.drawPixel(ex+1, ey+1, 30)
- ex = 0
- ey = 0
- bx = 0
- by = 0
- end
- end
- paintutils.drawPixel(ex, ey, 30)
- ex = ex - 1
- paintutils.drawPixel(ex, ey, 2)
- paintutils.drawPixel(bx, by, 30)
- bx = bx + 1
- paintutils.drawPixel(bx, by, 99)
- end
- elseif gs == 1 then
- term.clear()
- img = paintutils.loadImage(ptmainimg)
- paintutils.drawImage(img,1,1)
- if evt == "mouse_click" then
- gs = 0
- end
- end -- GS
- end -- Main while loop
Advertisement
Add Comment
Please, Sign In to add comment