Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local coords = {{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},{math.random(-14,14),math.random(-9,9),2^math.random(1,14)},}
- local map = window.create(term.native(),1,1,29,19)
- local oldCursorPos = map.setCursorPos
- local oldGetCP = map.getCursorPos
- local maxX, maxY = map.getSize()
- map.getCursorPos = function() local x,y = oldGetCP() return x-(math.ceil(maxX/2)),-(y-(math.ceil(maxY/2))) end
- map.setCursorPos = function(x,y) oldCursorPos(x+(math.ceil(maxX/2)),-(y-(math.ceil(maxY/2)))) end
- map.setBackgroundColor(colors.white)
- map.clear()
- map.setTextColor(colors.black)
- local stage = 1
- while true do
- local event, key = os.pullEvent("key")
- if key == keys.right then
- stage = stage - 1
- if stage < 1 then
- stage = 4
- end
- elseif key == keys.left then
- stage = stage + 1
- if stage > 4 then
- stage = 1
- end
- end
- map.setBackgroundColor(colors.white)
- map.clear()
- map.setBackgroundColor(colors.yellow)
- map.setCursorPos(0,0)
- map.write("^")
- for i,v in pairs(coords) do
- map.setBackgroundColor(v[3])
- if stage == 1 then
- map.setCursorPos(v[1],v[2])
- map.write("X")
- elseif stage == 2 then
- map.setCursorPos(v[2],-v[1])
- map.write("X")
- elseif stage == 3 then
- map.setCursorPos(-v[1],-v[2])
- map.write("X")
- elseif stage == 4 then
- map.setCursorPos(-v[2],v[1])
- map.write("X")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement