Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1, 1)
- print("Press O to switch to Object Layer")
- print("Press M to switch to Map Layer")
- print("Press up and down to switch colors")
- print("Press S to change brush to solid")
- print("Press F to change bruch to foreground")
- print("Left Click to place a block.")
- print("When you place an object it'll open up a code")
- print("editor.")
- print("Right Click to edit an object")
- print("Press A to save it.")
- print("Press any key to continue")
- os.pullEvent("key")
- term.clear()
- color = 1
- Pixels = {}
- rcolo = 1
- solid = 0
- foreg = 0
- while true do
- ev, p1, p2, p3 = os.pullEvent()
- if ev == "key" then
- if p1 == keys.o then
- elseif p1 == keys.m then
- elseif p1 == keys.up then
- if rcolo == colors.black then
- rcolo = colors.white
- else
- rcolo = bit.blshift(rcolo, 1)
- end
- elseif p1 == keys.down then
- if rcolo == colors.white then
- rcolo = colors.black
- else
- rcolo = bit.brshift(rcolo, 1)
- end
- elseif p1 == keys.s then
- if solid == 1 then solid = 0;
- elseif solid == 0 then solid = 1; end
- elseif p1 == keys.f then
- if foreg == 1 then foreg = 0;
- elseif foreg == 0 then foreg = 1; end
- elseif p1 == keys.a then
- term.setCursorPos(1, 1)
- words = ""
- term.write("File Name")
- name = read()
- file = fs.open(name, "w")
- print(#Pixels)
- for i = 1, #Pixels do
- if Pixels[i].color == colors.white then
- words = "1 "
- elseif Pixels[i].color == colors.orange then
- words = "2 "
- elseif Pixels[i].color == colors.magenta then
- words = "3 "
- elseif Pixels[i].color == colors.lightBlue then
- words = "4 "
- elseif Pixels[i].color == colors.yellow then
- words = "5 "
- elseif Pixels[i].color == colors.lime then
- words = "6 "
- elseif Pixels[i].color == colors.pink then
- words = "7 "
- elseif Pixels[i].color == colors.gray then
- words = "8 "
- elseif Pixels[i].color == colors.lightGray then
- words = "9 "
- elseif Pixels[i].color == colors.cyan then
- words = "A "
- elseif Pixels[i].color == colors.purple then
- words = "B "
- elseif Pixels[i].color == colors.blue then
- words = "C "
- elseif Pixels[i].color == colors.brown then
- words = "D "
- elseif Pixels[i].color == colors.green then
- words = "E "
- elseif Pixels[i].color == colors.red then
- words = "F "
- elseif Pixels[i].color == colors.black then
- words = "G "
- end
- words = words..tostring(Pixels[i].x).." "
- words = words..tostring(Pixels[i].y).." "
- words = words..tostring(Pixels[i].solid).." "
- words = words..tostring(Pixels[i].foreg)
- print(words)
- file:writeLine(words)
- sleep(0.5)
- end
- file:close()
- end
- elseif ev == "mouse_click" then
- Pixels[#Pixels+1] = {}
- Pixels[#Pixels].x = p2
- Pixels[#Pixels].y = p3
- Pixels[#Pixels].color = rcolo
- Pixels[#Pixels].solid = solid
- Pixels[#Pixels].foreg = foreg
- paintutils.drawPixel(Pixels[#Pixels].x, Pixels[#Pixels].y, Pixels[#Pixels].color)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment