Posted 27 March 2013 - 11:20 PM
Hey guys/girls.
I am trying to get a nice modular and compact way to show 'coordinates' on a screen, where a player can run around it.
I've done a few tests, and this was the best I could came up with.
For now, this is a prototype.
I hope someone can help…
I am trying to get a nice modular and compact way to show 'coordinates' on a screen, where a player can run around it.
I've done a few tests, and this was the best I could came up with.
-- "[]" = Block
-- " " = Air
-- "##"=Player
local co1 = {"[]", " ", "[]"}
local co2 = {"[]", "##", " "}
local i
function printCoords()
for i = 1, 3 do
term.write("" ..co1[i])
end
print("")
for i = 1, 3 do
term.write("" ..co2[i])
end
print("")
end
function checkCoords()
for i = 1, 3 do
f = co1[i]
if f == "##" then
end
end
for i = 1, 3 do
f = co2[i]
if f == "##" then
movePlayerRight()
end
end
end
function movePlayerRight() --Getting a error around here-ish, table index expexted, got nil
co2[i] = " "
co2[i+1] = "##''
end
printCoords()
checkCoords()
printCoords()
For now, this is a prototype.
I hope someone can help…