rem death valley
rem Daniel Isaaman and Jenny Tyler
rem translated to BB4Win by T Street
rem 14/03/2013
rem ENSURE YOU HAVE "LOWERCASE KEYWORDS" SELECTED IN THE OPTIONS!
mode 10 : off
print "DEATH VALLEY"
delay% = 30 : rem how long to wait for the player to press a key
dead% = false : rem keeps track of whether you have crashed or not
go% = 200 : rem number of turns left
screenWidth% = 70 : rem width of whole screen
w% = 10 : rem width of valley
l% = 10 : rem width of left-hand side
y% = w% : rem width of middle region
r% = w% : rem width of right hand side
repeat
remprint tab(0,0)l%,y%,r%
rem change the wall positions
rem randomly move one place left, right or not at all
repeat
d% = rnd(3)-2 : rem sets a random direction -1,0 or +1
rem check that the new position is not off the screen
until l%+d%>0 and r%+d%<screenWidth%
rem change the value of the wall positions depending on the
rem value of d%
l% = l% + d%
r% = r% + d%
y% = y% - d%
rem check whether the player is dead
if l% = 0 or r% = 0 or y% <= 0 then
dead% = true
endif
if notdead% then
rem print walls
print string$(l%," ")"I";
print string$(y%," ")"*";
print string$(r%," ")"I ";
print
else
print string$(y%+l%," ")"RIP"
endif
if notdead% then
rem get user input
time = 0
g% = inkey(delay%) : rem wait user to press left or right
wait( delay% - time ) : rem wait for the rest of the delay time
rem move the player based on their current movement choice
case g% of
when 136 rem left
y% = y% - 1
r% = r% + 1
when 137 rem right
y% = y% + 1
r% = r% - 1
endcase
rem reduce number of gos left
go% = go% - 1
endif
until go%=0 or dead%
print"GAME OVER"
if notdead% then
print "CONGRATULATIONS!"
print"You made it!"
else
print "Oh, dear!"
endif
How can you change the width of the canyon?
How can you increase the length of the canyon?
There is plenty of scope here for modifications. How about changing the colours, or redesigning graphics characters?
Death Valley - avoid the walls, or face a nasty end (sort of)! |