CLS '############################################ '#########--define the game map--############ '############################################ DIM Shared fld(31) As string fld(1) = "##################################################################" fld(2) = "# 2 #" fld(3) = "# 9 1617 #" fld(4) = "# 1 0 44 4444 #" fld(5) = "# 1 #" fld(6) = "# 101 2 #" fld(7) = "# 1 2 122 888 8 #" fld(8) = "# 121 #" fld(9) = "# 1 666 6 #" fld(10) = "# 13141 #" fld(11) = "# 45 22 #" fld(12) = "# 13 yy #" fld(13) = "# 1718 #" fld(14) = "# 111 1 2222 22 #" fld(15) = "# 21 #" fld(16) = "# 151617 #" fld(17) = "# 16 tt #" fld(18) = "# 1 81 #" fld(19) = "# 41 #" fld(20) = "# 13 11 22 jjj #" fld(21) = "# 3 3 44 5 5 5 2 #" fld(22) = "# 4 4 5 7 8 8 8 888 #" fld(23) = "# 6 6 6 6 66 445 #" fld(24) = "# 3 44 3 22 78 #" fld(25) = "# 999 9 9 999 55 77 #" fld(26) = "# 222 2 2 22 2 #" fld(27) = "# 7 777 7 777 #" fld(28) = "# 0 00 000 0 333 3 #" fld(29) = "# 111 1 11 11 2 #" fld(30) = "# 22 2 2 22 2 2 77 #" fld(31) = "##################################################################" DivLineCol = 40 FrameHeight = 25 Orig1row = 1 Orig1col = 1 Orig2row = 1 Orig2col = DivLineCol + 1 U1row = Orig1row + (FrameHeight/2) U1col = Orig1col + (DivLineCol/2) U2row = U1row U2col = DivLineCol + U1col U1x = 17 U1y = 17 U2x = 25 U2y = 17 ColMapBuff = 12 '15 RowMapBuff = 8 '11 DIM old1MAp As string = " " DIM old2Map As string = " " MID$(fld(U1y), U1x, 1) = "O" MID$(fld(U2y), U2x, 1) = "O" '############################################ '########--draw the split screen--########### '############################################ FOR count = 1 to FrameHeight LOCATE count, DivLineCol PRINT "|" :REM PRINT the maze NEXT count '############################################ '#########--display the start map--########## U1 '############################################ LOCATE Orig1row, Orig1col PrintRow = U1row - RowMapBuff PrintCol = U1col - ColMapBuff FOR county = (U1y - RowMapBuff) to (U1y + RowMapBuff) PrintRow = PrintRow + 1 FOR countx = (U1x - ColMapBuff) to (U1x + ColMapBuff) PrintCol = PrintCol + 1 LOCATE PrintRow, PrintCol Print MID$(fld(county), countx, 1) NEXT countx PrintCol = U1col - ColMapBuff NEXT county '############################################ '#########--display the start map--########## U2 '############################################ LOCATE Orig2row, Orig2col PrintRow = U2row - RowMapBuff PrintCol = U2col - ColMapBuff FOR county = (U2y - RowMapBuff) to (U2y + RowMapBuff) PrintRow = PrintRow + 1 FOR countx = (U2x - ColMapBuff) to (U2x + ColMapBuff) PrintCol = PrintCol + 1 LOCATE PrintRow, PrintCol Print MID$(fld(county), countx, 1) NEXT countx PrintCol = U2col - ColMapBuff NEXT county DO '############################################ '#########--wait for a key press--########### '############################################ DO :REM "" old1x = U1x :REM remember old position of PACMAN old1y = U1y old2x = U2x :REM remember old position of PACMAN old2y = U2y '############################################ '#####--record key presses for movement--#### '############################################ IF (keyed$ = "w") AND MID$(fld(U1y - 1), U1x, 1) <> "#" THEN U1y = U1y - 1 IF (keyed$ = "s") AND MID$(fld(U1y + 1), U1x, 1) <> "#" THEN U1y = U1y + 1 IF (keyed$ = "a") AND MID$(fld(U1y), U1x - 1, 1) <> "#" THEN U1x = U1x - 1 IF (keyed$ = "d") AND MID$(fld(U1y), U1x + 1, 1) <> "#" THEN U1x = U1x + 1 IF (keyed$ = "i") AND MID$(fld(U2y - 1), U2x, 1) <> "#" THEN U2y = U2y - 1 IF (keyed$ = "k") AND MID$(fld(U2y + 1), U2x, 1) <> "#" THEN U2y = U2y + 1 IF (keyed$ = "j") AND MID$(fld(U2y), U2x - 1, 1) <> "#" THEN U2x = U2x - 1 IF (keyed$ = "l") AND MID$(fld(U2y), U2x + 1, 1) <> "#" THEN U2x = U2x + 1 IF U1y <> old1y OR U1x <> old1x THEN MID$(fld(old1y), old1x, 1) = old1Map old1Map = MID$(fld(U1y), U1x, 1) MID$(fld(U1y), U1x, 1) = "O" END IF IF U2y <> old2y OR U2x <> old2x THEN MID$(fld(old2y), old2x, 1) = old2Map old2Map = MID$(fld(U2y), U2x, 1) MID$(fld(U2y), U2x, 1) = "O" END IF '############################################ '########--redraw the map around c--######### U1 '############################################ LOCATE Orig1row, Orig1col PrintRow = U1row - RowMapBuff PrintCol = U1col - ColMapBuff FOR county = (U1y - RowMapBuff) to (U1y + RowMapBuff) PrintRow = PrintRow + 1 FOR countx = (U1x - ColMapBuff) to (U1x + ColMapBuff) PrintCol = PrintCol + 1 LOCATE PrintRow, PrintCol Print MID$(fld(county), countx, 1) NEXT countx PrintCol = U1col - ColMapBuff NEXT county '############################################ '########--redraw the map around c--######### U2 '############################################ LOCATE Orig2row, Orig2col PrintRow = U2row - RowMapBuff PrintCol = U2col - ColMapBuff FOR county = (U2y - RowMapBuff) to (U2y + RowMapBuff) PrintRow = PrintRow + 1 FOR countx = (U2x - ColMapBuff) to (U2x + ColMapBuff) PrintCol = PrintCol + 1 LOCATE PrintRow, PrintCol Print MID$(fld(county), countx, 1) NEXT countx PrintCol = U2col - ColMapBuff NEXT county LOOP youwon: '############################################ '#####--you win when you find the 'O'--###### '############################################ LOCATE 17, 20 PRINT "You got the gold!" LOCATE 19, 20 PRINT "press any key to exit, ass" sleep clearkey$ = inkey