rem Turn off typing cursor
mode 6
off
rem The Sprite
vdu 23,240,36,62,106,255,195,126,36,36
rem The Prey
vdu 23,241,96,32,32,60,60,60,20,20
x%=20
y%=15
rem show the monster
print tab(x%,y%)chr$(240)
sprite$ =chr$(240)
prey$ =chr$(241)
score%=0
samexy%=false
print tab(0,0) score%
dim Prey_X%(10)
dim Prey_Y%(10)
numPrey% = 10
rem set up prey
for n% = 1 to numPrey%
read Prey_X%( n% )
read Prey_Y%( n% )
next
data 16,5,6,7,14,20,20,12,8,10,15,15,12,6,5,20,10,10,9,7
rem display the prey
for A%=1 to 10
print tab(Prey_X%( A% ),Prey_Y%( A% ))chr$(241)
next
rem repeating the cycle
repeat
rem get the user's key
g%= get
print tab(x%,y%)chr$(32)
rem Find out the key
case g% of
when 136: if x%>5 then x%-=1
when 137: if x%<35 then x%+=1
when 139: if y%>2 then y%-=1
when 138: if y%<23 then y%+=1
endcase
print tab(x%,y%)chr$(240)
rem Scoring system
for index% = 1 to 10
if Prey_X%(index%) = x% and Prey_Y%(index%) = y% then
rem samexy% = true This is really redundant, isn't it? We can simply move the score bit into this IF
print tab(Prey_X%(index%),Prey_Y%(index%)) chr$(240)
Prey_X%(index%)=-1
Prey_Y%(index%)=-1
score%+=10
print tab(0,0) score%
endif
next
rem until score%=100 rem The place highlighted "Not in a REPEAT loop"
if score%=100 then
print "Well Done, You Have Killed All The Prey! "
stop
endif
until false
rem turn cursor on
on