# This does not work, I have tryed everything you have said

July 7 2006 at 12:30 PM

DEFINT A-Z 'make everything an Integer unless we specify otherwise

DECLARE FUNCTION formatday\$ (day AS INTEGER)
DECLARE FUNCTION formattime\$ (tim AS INTEGER)

DIM start AS SINGLE, elapsed AS SINGLE, t AS SINGLE

DIM maze(1 TO 4, 1 TO 20) AS STRING

maze(1, 1) = " ############################# #####################################"
maze(1, 2) = " # ## ## #"
maze(1, 3) = " # #"
maze(1, 4) = " # #"
maze(1, 5) = " # #"
maze(1, 6) = " # #"
maze(1, 7) = " # #"
maze(1, 8) = " # #"
maze(1, 9) = " # #"
maze(1, 10) = " "
maze(1, 11) = " # #"
maze(1, 12) = " # #"
maze(1, 13) = " # #"
maze(1, 14) = " # #"
maze(1, 15) = " # #"
maze(1, 16) = " #* #"
maze(1, 17) = " #* #"
maze(1, 18) = " #* #"
maze(1, 19) = " #* * * ## ## #"
maze(1, 20) = " ############################# #####################################"

maze(2, 1) = " ############################## ####################################"
maze(2, 2) = " # ## ## #"
maze(2, 3) = " # r #"
maze(2, 4) = " # #"
maze(2, 5) = " # #"
maze(2, 6) = " # #"
maze(2, 7) = " # #"
maze(2, 8) = " # #"
maze(2, 9) = " # ##"
maze(2, 10) = " "
maze(2, 11) = " # ##"
maze(2, 12) = " # #"
maze(2, 13) = " # #"
maze(2, 14) = " # #"
maze(2, 15) = " # #"
maze(2, 16) = " #* #"
maze(2, 17) = " #* #"
maze(2, 18) = " #* #"
maze(2, 19) = " #* * * ## ## #"
maze(2, 20) = " ############################## ####################################"

maze(3, 1) = " ############################## ####################################"
maze(3, 2) = " # ## ## #"
maze(3, 3) = " # l #"
maze(3, 4) = " # #"
maze(3, 5) = " # #"
maze(3, 6) = " # #"
maze(3, 7) = " # #"
maze(3, 8) = " # #"
maze(3, 9) = "## #"
maze(3, 10) = " "
maze(3, 11) = "## #"
maze(3, 12) = " # #"
maze(3, 13) = " # #"
maze(3, 14) = " # #"
maze(3, 15) = " # #"
maze(3, 16) = " #* #"
maze(3, 17) = " #* #"
maze(3, 18) = " #* #"
maze(3, 19) = " #* * * ## ## #"
maze(3, 20) = " ############################## ####################################"

maze(4, 1) = " ############################# #####################################"
maze(4, 2) = " # #"
maze(4, 3) = " # l #"
maze(4, 4) = " # #"
maze(4, 5) = " # #"
maze(4, 6) = " # #"
maze(4, 7) = " # #"
maze(4, 8) = " # #"
maze(4, 9) = "## #"
maze(4, 10) = " "
maze(4, 11) = "## #"
maze(4, 12) = " # #"
maze(4, 13) = " # #"
maze(4, 14) = " # #"
maze(4, 15) = " # #"
maze(4, 16) = " #* #"
maze(4, 17) = " #* #"
maze(4, 18) = " #* #"
maze(4, 19) = " #* * * #"
maze(4, 20) = " ############################ ######################################"

CONST uplimit = 0
CONST leftlimit = 1
CONST rightlimit = 69
CONST downlimit = 21

GOSUB prep
GOSUB middle

'initialize game

DO 'main game loop
LOCATE oldrow, oldcolumn
PRINT MID\$(maze(oldrow), oldcolumn, 1); 'redraw previous square.
LOCATE row, column
PRINT "X";

DO 'keyboard and clock loop

elapsed = t - start
IF oelap <> INT(elapsed) THEN 'update clock display
oelap = INT(elapsed)
END IF
keyed\$ = INKEY\$
LOOP UNTIL (keyed\$ <> "")

oldrow = row
oldcolumn = column

SELECT CASE keyed\$ 'handle keyboard input
CASE CHR\$(27): EXIT DO ' ESC quits
CASE CHR\$(0) + CHR\$(72): IF row > uplimit THEN row = row - 1
CASE CHR\$(0) + CHR\$(75): IF column > leftlimit THEN column = column - 1
CASE CHR\$(0) + CHR\$(77): IF column < rightlimit THEN column = column + 1
CASE CHR\$(0) + CHR\$(80): IF row < downlimit THEN row = row + 1
END SELECT

tselect:
' row and column inputs
IF t = 0 AND row = 10 AND column = 69 THEN
GOSUB right
row = 10
column = 3
END IF

IF t = 0 AND row = 10 AND column = 1 THEN
GOSUB left
row = 10
column = 67
END IF
IF t = 5 AND row = 10 AND column = 1 THEN
GOSUB middle
row = 10
column = 67
END IF
IF t = 10 AND row = 10 AND column = 69 THEN
GOSUB middle
row = 10
column = 3
END IF

IF t = 10 AND row = 10 AND column = 1 THEN t = 10
IF t = 5 AND row = 10 AND column = 69 THEN t = 5
IF t = 10 AND row = 2 AND column = 30 THEN
GOSUB ul
END IF

LOCATE 10, 10
PRINT t

SELECT CASE MID\$(maze\$(row), column, 1) 'what square am I on?
CASE "#" 'wall
row = oldrow
column = oldcolumn
END SELECT

SELECT CASE MID\$(mazer\$(row), column, 1) 'what square am I on?
CASE "#" 'wall
row = oldrow
column = oldcolumn
END SELECT

SELECT CASE MID\$(mazel\$(row), column, 1) 'what square am I on?
CASE "#" 'wall
row = oldrow
column = oldcolumn
END SELECT

SELECT CASE MID\$(mazeul\$(row), column, 1) 'what square am I on?
CASE "#" 'wall
row = oldrow
column = oldcolumn
END SELECT

LOOP
SYSTEM

middle:
t = 0
count = 0
CLS
FOR count = 1 TO 21

PRINT maze\$(count)
NEXT count
RETURN

right:
t = 5
CLS
count = 0
FOR count = 1 TO 21
PRINT mazer\$(count)
NEXT count
RETURN
left:
t = 10
CLS
count = 0
FOR count = 1 TO 21
PRINT mazel\$(count)
NEXT count

RETURN
ul:
t = 15
CLS
count = 0
FOR count = 1 TO 21
PRINT mazeul\$(count)
NEXT count

RETURN

prep: 'initiallizes the game
row = 5
column = 3
oldrow = row
oldcolumn = column

RETURN 'always end subroutines with RETURN

RETURN

FUNCTION formatday\$ (day AS INTEGER)
DEFINT A-Z
formatday\$ = MID\$("SunMonTueWedThuFriSat", (day * 3) + 1, 3)
END FUNCTION

FUNCTION formattime\$ (tim AS INTEGER)
DEFINT A-Z
hour = (tim * 24&) \ secsPerDay
min = ((tim * 1440&) \ secsPerDay) MOD 60
SELECT CASE hour
CASE 0: hour = 12: t\$ = "AM"
CASE IS > 12: hour = hour - 12: t\$ = "PM"
CASE ELSE: t\$ = "AM"
END SELECT
m\$ = LTRIM\$(STR\$(min))
m\$ = STRING\$(2 - LEN(m\$), "0") + m\$ 'make sure it has 2 digits

formattime = LTRIM\$(STR\$(hour)) + ":" + m\$ + " " + t\$
END FUNCTION

 Respond to this message
'TzmNe!!!

# Re: This does not work, I have tryed everything you have said

July 7 2006, 1:14 PM
 SELECT CASE MID\$(maze\$(row), column, 1) 'what square am I on? -> maze needs two numbers -> maze does not need a "\$" For level one (or maze one): SELECT CASE MID\$(maze(1,row), column, 1) 'what square am I on? So you probably need to change some other things, too. {:-D)
 Respond to this message
drew

# * Thank you, I knew I didnt need the \$, and i knew i needed a (1, 1) or sometin but where?

July 7 2006, 6:26 PM
 Respond to this message
drew

# This shortend my code a little but it still is messing up.

July 7 2006, 6:45 PM
 This 2d array thing is helping alot, and it is working, but how do I make it so one arrary doesnt over lap another. Like I put a random ###### in the middle of the first one, (wall, you cant walk through walls), then I tested it and When it was on the first array, I could see the ##### and i could not walk through it then when i opend up the second array, I could NOT see the #####, but when I tryed to walk where it was, it acted as an invisible wall, why is one 2d array going onto the next one, I mean i have the cls correct and everything...
 Respond to this message
drew