Code: Select all
SETUP:
COLOR 1,0
X = 5
Y = 5
EX = 14
EY = 14
MS = 1
CLS
SCREEN 3
GOTO GAME
GAME:
IF INT(EX) = INT(X) AND INT(EY) = INT(Y) THEN GOTO GAMEOVER
TILE X,Y,96
V=JOY(0)
IF V AND 8 THEN Y = Y - MS
IF V AND 4 THEN Y = Y + MS
IF V AND 2 THEN X = X - MS
IF V AND 1 THEN X = X + MS
IF Y>38 THEN Y = Y + MS
IF Y<2 THEN Y = Y - MS
IF X<2 THEN Y = Y + MS
IF X>38 THEN Y = Y - MS
COLOR 5
TILE X,Y,16
COLOR 1
TILE EX, EY, 96
GOSUB ENEMYMOVE
COLOR 2
TILE EX, EY, 5
COLOR 1
SLEEP 7
GOTO GAME
ENEMYMOVE:
IF X<EX THEN EX = EX - 0.3
IF Y<EY THEN EY = EY - 0.3
IF X>EX THEN EX = EX + 0.3
IF Y>EY THEN EY = EY + 0.3
RETURN
GAMEOVER:
CLS
PRINT "YOU LOSE!"
SLEEP 100
SCREEN 0
COLOR 1,6
CLS