Lol I still don't understand, I would need to actually talk to one of you anyway here's my code.
local direction = ">"
local x1, y1 = term.getSize()
local currentX = x1/2
local currentY = y1/2
term.clear()
textutils.slowPrint("Navigator Game by: Wing")
textutils.slowPrint("Use W,A,S,D to Navigate the world")
textutils.slowPrint("Avoid the Moving Monsters")
textutils.slowPrint("Collect the Star to win!")
sleep(2)
function collision(cX, cY, sign)
term.setCursorPos(cX, cY)
write(sign)
if cX == currentX and cY == currentY then
if direction == "^" then
currentY = currentY +1
elseif direction == "v" then
currentY = currentY -1
elseif direction == ">" then
currentX = currentX -1
elseif direction == "<" then
currentX = currentX +1
end
draw()
end
end
function map()
----------------------- Vertical Left
collision(1,1, "O")
collision(1,2, "|")
collision(1,3, "|")
collision(1,4, "|")
collision(1,5, "|")
collision(1,6, "|")
collision(1,7, "|")
collision(1,8, "|")
collision(1,9, "|")
collision(1,10, "|")
collision(1,11, "|")
collision(1,12, "|")
collision(1,13, "|")
collision(1,14, "|")
collision(1,15, "|")
collision(1,16, "|")
collision(1,17, "|")
collision(1,18, "O")
-------------------------- Right Vertical
collision(49,1, "0")
collision(49,2, "|")
collision(49,3, "|")
collision(49,4, "|")
collision(49,5, "|")
collision(49,6, "|")
collision(49,7, "|")
collision(49,8, "|")
collision(49,9, "|")
collision(49,10, "|")
collision(49,11, "|")
collision(49,12, "|")
collision(49,13, "|")
collision(49,14, "|")
collision(49,15, "|")
collision(49,16, "|")
collision(49,17, "|")
collision(49,18, "0")
-------------------------- Top Horizontal
collision(2,1, "-")
collision(3,1, "-")
collision(4,1, "-")
collision(5,1, "-")
collision(6,1, "-")
collision(7,1, "-")
collision(8,1, "-")
collision(9,1, "-")
collision(10,1, "-")
collision(11,1, "-")
collision(12,1, "-")
collision(13,1, "-")
collision(14,1, "-")
collision(15,1, "-")
collision(16,1, "-")
collision(17,1, "-")
collision(18,1, "-")
collision(19,1, "-")
collision(20,1, "-")
collision(21,1, "-")
collision(22,1, "-")
collision(23,1, "-")
collision(24,1, "-")
collision(25,1, "-")
collision(26,1, "-")
collision(27,1, "-")
collision(28,1, "-")
collision(29,1, "-")
collision(30,1, "-")
collision(31,1, "-")
collision(32,1, "-")
collision(33,1, "-")
collision(34,1, "-")
collision(35,1, "-")
collision(36,1, "-")
collision(37,1, "-")
collision(38,1, "-")
collision(39,1, "-")
collision(40,1, "-")
collision(41,1, "-")
collision(42,1, "-")
collision(43,1, "-")
collision(44,1, "-")
collision(45,1, "-")
collision(46,1, "-")
collision(47,1, "-")
collision(48,1, "-")
------------------------- Bottom Horizontal
collision(2,18, "-")
collision(3,18, "-")
collision(4,18, "-")
collision(5,18, "-")
collision(6,18, "-")
collision(7,18, "-")
collision(8,18, "-")
collision(9,18, "-")
collision(10,18, "-")
collision(11,18, "-")
collision(12,18, "-")
collision(13,18, "-")
collision(14,18, "-")
collision(15,18, "-")
collision(16,18, "-")
collision(17,18, "-")
collision(18,18, "-")
collision(19,18, "-")
collision(20,18, "-")
collision(21,18, "-")
collision(22,18, "-")
collision(23,18, "-")
collision(24,18, "-")
collision(25,18, "-")
collision(26,18, "-")
collision(27,18, "-")
collision(28,18, "-")
collision(29,18, "-")
collision(30,18, "-")
collision(31,18, "-")
collision(32,18, "-")
collision(33,18, "-")
collision(34,18, "-")
collision(35,18, "-")
collision(36,18, "-")
collision(37,18, "-")
collision(38,18, "-")
collision(39,18, "-")
collision(40,18, "-")
collision(41,18, "-")
collision(42,18, "-")
collision(43,18, "-")
collision(44,18, "-")
collision(45,18, "-")
collision(46,18, "-")
collision(47,18, "-")
collision(48,18, "-")
-------------------------- Center Above
--collision(25, 8, "-")
-------------------------- Walls 2*
collision(2, 3, "O")
collision(2, 4, "|")
collision(2, 5, "|")
collision(2, 6, "O")
collision(2, 10, "O")
collision(2, 11, "|")
collision(2, 12, "|")
collision(2, 13, "|")
collision(2, 14, "|")
collision(2, 15, "|")
collision(2, 16, "|")
collision(2, 17, "O")
------------------------ Walls 3*
collision(3, 3, "-")
collision(3, 8, "-")
collision(3, 10, "O")
collision(3, 11, "|")
collision(3, 12, "|")
collision(3, 13, "O")
collision(3, 15, "O")
collision(3, 16, "O")
collision(3, 17, "O")
------------------------ Walls 4*
collision(4, 3, "O")
collision(4, 4, "|")
collision(4, 5, "|")
collision(4, 6, "O")
collision(4, 8, "-")
collision(4, 16, "-")
------------------------ Walls 5*
collision(5, 3, "O")
collision(5, 4, "|")
collision(5, 5, "|")
collision(5, 6, "O")
collision(5, 8, "O")
collision(5, 9, "|")
collision(5, 10, "|")
collision(5, 11, "|")
collision(5, 12, "O")
collision(5, 13, "|")
collision(5, 14, "O")
collision(5, 16, "-")
end
function draw()
term.clear()
map()
term.setCursorPos(currentX, currentY)
write(direction)
end
while true do
draw()
local sEvent, button = os.pullEvent("key")
if (sEvent == "key") then
if (button == 17) then
currentY = currentY -1
direction = "^"
term.setCursorPos(currentX, currentY)
write(direction)
elseif (button == 31) then
currentY = currentY +1
direction = "v"
term.setCursorPos(currentX, currentY)
write(direction)
elseif (button == 30) then
currentX = currentX -1
direction = "<"
term.setCursorPos(currentX, currentY)
write(direction)
elseif (button == 32) then
currentX = currentX +1
direction = ">"
term.setCursorPos(currentX, currentY)
write(direction)
end
end
end