Rem Project: 20 Lines
Rem Created: 4/19/2004 1:12:33 AM
Rem ***** Main Source File *****
REM A 20 line game by Pheonixx
REM OBJECT : GET THE KEY AND GET OUT
REM WALLS ARE GREY
REM PLAYER IS GREEN
REM KEY IS GOLD
REM DOOR IS BROWN
#CONSTANT BLACK = RGB(0,0,0)
#CONSTANT GREY = RGB(128,128,128)
#CONSTANT GOLD = RGB(128,128,0)
#CONSTANT GREEN = RGB(0,128,0)
#CONSTANT BROWN = RGB(96,64,64)
DIM MAP(10,10) : FOR Z = 0 TO 9 : FOR X = 0 TO 9 : READ MAP(X,Z) : NEXT X : NEXT Z : KEYHOLD = 0
SYNC ON : SYNC RATE 10 : DO : A$ = UPPER$(INKEY$()) : FOR Z = 0 TO 9 : FOR X = 0 TO 9
IF MAP(X,Z) = 0 THEN BOX X*10,Z*10,X*10+10,Z*10+10,BLACK,BLACK,BLACK,BLACK
IF MAP(X,Z) = 1 THEN BOX X*10,Z*10,X*10+10,Z*10+10,GREY,GREY,GREY,GREY
IF MAP(X,Z) = 8 : BOX X*10+2,Z*10+2,X*10+8,Z*10+8,GREEN,GREEN,GREEN,GREEN : PLAYERX = X : PLAYERZ = Z : ENDIF
IF MAP(X,Z) = 9 : BOX X*10+3,Z*10+3,X*10+7,Z*10+7,GOLD,GOLD,GOLD,GOLD : KEYX = X : KEYZ = Z : ENDIF
IF MAP(X,Z) = 10 : BOX X*10+1,Z*10+1,X*10+9,Z*10+9,BROWN,BROWN,BROWN,BROWN : DOORX = X : DOORZ = Z : ENDIF
NEXT X : NEXT Z
SELECT A$:CASE "A":IF MAP(PLAYERX-1,PLAYERZ) > 2 OR MAP(PLAYERX-1,PLAYERZ) = 0:MAP(PLAYERX,PLAYERZ) = 0:MAP(PLAYERX-1,PLAYERZ) = 8:ENDIF:ENDCASE:CASE "D":IF MAP(PLAYERX+1,PLAYERZ) > 2 OR MAP(PLAYERX+1,PLAYERZ) = 0:MAP(PLAYERX,PLAYERZ) = 0:MAP(PLAYERX+1,PLAYERZ) = 8:ENDIF:ENDCASE:CASE "W":IF MAP(PLAYERX,PLAYERZ-1) > 2 OR MAP(PLAYERX,PLAYERZ-1) = 0:MAP(PLAYERX,PLAYERZ) = 0:MAP(PLAYERX,PLAYERZ-1) = 8:ENDIF:ENDCASE:CASE "X":IF MAP(PLAYERX,PLAYERZ+1) > 2 OR MAP(PLAYERX,PLAYERZ+1) = 0:MAP(PLAYERX,PLAYERZ) = 0:MAP(PLAYERX,PLAYERZ+1) = 8:ENDIF:ENDCASE:CASE DEFAULT:ENDCASE:ENDSELECT
IF PLAYERX = KEYX AND PLAYERZ = KEYZ AND KEYHOLD = 0 : KEYHOLD = 1 : TEXT 20,100,"PICKED UP KEY" : SYNC : WAIT 500 : CLS : ENDIF
IF PLAYERX = DOORX AND PLAYERZ = DOORZ AND KEYHOLD = 1 : TEXT 20,100,"YOU WIN" : SYNC : WAIT 1000 : EXIT : ENDIF
IF PLAYERX = DOORX AND PLAYERZ = DOORZ AND KEYHOLD = 0 : TEXT 20,100,"YOU NEED THE KEY" : SYNC : WAIT 500 : CLS : ENDIF
IF KEYHOLD = 0 THEN MAP(DOORX,DOORZ) = 10
SYNC : LOOP : END
REM 1 WALL 8 PLAYER LOCATION 9 KEY LOCATION 10 DOOR LOCATION
DATA 01,01,01,01,01,01,01,01,01,01,01,08,01,00,01,00,00,00,00,01,01,00,01,00,01,01,00,01,01,01,01,00,01,00,00,01,00,00,00,01,01,00,00,00,00,00,00,01,01,01,01,01,01,01,00,01,00,01,10,01,01,09,00,00,00,01,00,01,00,01,01,01,00,01,00,01,00,01,00,01,01,00,00,01,00,01,00,00,00,01,01,01,01,01,01,01,01,01,01,01
Not the most impressive thing ever
Be a genious, and use the caps lock key, using the A,D,W,X keys for movement.
1 hour 10 minutes programming time