Okay.. You've gotten lots of help but a little more couldn't hurt, first of all you should select the players starting position
--# Getting the terminal width and height
local w, h = term.getSize()
--# The players data in a table
local player = {
x = math.ceil(w/2),
y = math.ceil(h/2),
art = "x",
},
This will make the player start in the middle of the screen, Now let's move onto actually drawing the player
--# This function clears the screen
local function clear()
term.clear()
term.setCursorPos(1,1)
end
--# This function sets the cursorpos and then draws text there
local function drawAt(x, y, text)
term.setCursorPos(x,y)
term.write(text)
end
while true do
clear()
drawAt(player.x, player.y, player.art)
-- Events here
end
Now I'll show you a simple example of how you can use events
local evt, p1 = os.pullEvent() --# Waiting for an event to be pulled
if evt == "key" then --# Checking if the event was a key event
if p1 == keys.up then --# Checking which key was pressed and if it was the up key
player.y = player.y - 1 --# Changing the players y position
elseif p1 == keys.down then
player.y = player.y + 1
elseif p1 == keys.left then
player.x = player.x - 1
elseif p1 == keys.right then
player.x = player.x + 1
end
end
Well this is a simple example of how you can move a player around the screen, Hope it helped ;)/>
- Hellkid98