Here's the pseudo code I'd use:
Code:
set initial coordinates X and Y
start a loop
draw character at coordinates X and Y ("Locate" command)
get user input ("Inkey$" command)
erase character at coordinates X and Y ("Locate" again)
change coordinates X and Y depending on user input (just math)
end loop if user hit the exit key or if character died, or whatever
As to the second part of your question, you've got two options from what I can think of:
option 1.. use a 2-dimensional array.
----------------------------------------------
In this method, you have a 2D array-- Maze(1 to 80, 1 to 24) as STRING * 1, for example. This array holds all the letters that are on the screen, so when the user enters a direction you can check to make sure it's a valid move before you change the coordinates of the character. If they enter an invalid move, then don't update the coordinates. That way the character will be redrawn exactly where it already was.
option 2.. use the SCREEN command.
-----------------------------------------------
You can retrieve the ASCII code of a character on the screen by using the SCREEN function. Note that this is different than the SCREEN statement! For example:
Code:
if CHR$(SCREEN(RowToCheck%, ColumnToCheck%)) = "W" then...
You could use this to see whether the square the character is trying to move to contains a W or not. If it does, don't update the character's coordinates.
Hope this helps.
*peace*
Meg.