07-17-2023, 12:09 AM
Here's yet another silly game that I remembered from one of David L. Heiserman's books. But it's "customized" to my taste and knowledge of BASIC programming LOL. In this game you play a stunt paratrooper jumping out of a plane trying to evade buildings. The game should be straightforward, giving instructions on the screen. Either you jump or you don't, and if you jump don't go "splat" into a building and don't go off a side of the screen! The plane does a "loop" back to the beginning so it could wrap around the screen but the stunt paratrooper can't!
There is a peculiar RANDOMIZE statement, allowing a player to "practice" this program.
I should allocate some time for sound effects for this program. The original program had a quirk about the protagonist but didn't care how he/she was called. In fact I programmed another quirk before deciding to submit this, heh heh.
There is a peculiar RANDOMIZE statement, allowing a player to "practice" this program.
I should allocate some time for sound effects for this program. The original program had a quirk about the protagonist but didn't care how he/she was called. In fact I programmed another quirk before deciding to submit this, heh heh.
Code: (Select All)
'by mnrvovrfc 17-July-2023
option _explicit
dim nm$(1 to 7), histogram(1 to 80) as integer
dim as integer i, j, h, v, w, z, numtiles, numthalf, thresh
dim as integer x, y, px, py, fuel, recede, planecolor
dim ke$, handl$, jumped as _bit, die as integer
nm$(1) = "murderflower"
nm$(2) = "jumpdaplain"
nm$(3) = "sinusister"
nm$(4) = "quakefear"
nm$(5) = "adrenald"
nm$(6) = "houston"
nm$(7) = "rebare"
print "Welcome to Stunt Paratrooper!"
print: print "Please choose who do you want to be. Press any number key from [1] to [7]."
for i = 1 to 7
print "("; _trim$(str$(i)); ") "; nm$(i)
next
do
do : ke$ = inkey$ : loop while ke$ = ""
if ke$ = chr$(27) then end
v = val(ke$)
loop until v > 0 and v < 8
handl$ = nm$(v)
v = ubound(nm$) - v + 4
randomize v + 100
numtiles = 200
numthalf = numtiles \ 2
thresh = 5
cls
for i = 1 to numthalf
j = Random1(80)
histogram(j) = histogram(j) + 1
next
h = 0
for i = 1 to 80
if histogram(i) > h then h = histogram(i)
next
for i = 1 to numthalf
do
j = Random1(80)
loop until abs(histogram(j) - h) <= thresh
histogram(j) = histogram(j) + 1
next
h = 0
for i = 1 to 80
if histogram(i) > h then
h = histogram(i)
w = i
end if
if histogram(i) = 0 then histogram(i) = 1
next
if w = 80 then
z = 80
w = 78
else
z = w + 2
end if
histogram(w + 1) = 0
color 6
locate 25, 1 : print string$(79, 46);
locate 24, 1 : print string$(80, 46);
color 8
for i = 1 to 80
y = 24
for j = histogram(i) to 1 step -1
locate y, i
print chr$(177);
y = y - 1
if y < 10 then exit for
next
next
color 4
locate 1, 1 : print handl$;
color 3
print " you have to hit the grass between those buildings! Good luck!"
color 5
locate 2, 1 : print "Press [ESC] to quit. Press spacebar to jump out of plane."
fuel = 6
recede = fuel - 1
jumped = 0
x = 1
y = 5
planecolor = 7
do : ke$ = inkey$ : loop until ke$ = ""
do
color planecolor
locate y, x : print "|_^";
for i = 1 to 10
_delay 0.05
ke$ = inkey$
if ke$ <> "" then
if ke$ = chr$(27) then system
if ke$ = chr$(32) then
jumped = 1
exit for
end if
end if
next
locate y, x : print space$(3);
x = x + 1
if x > 78 then
x = 1
if y < 8 then y = y + 1
fuel = fuel - 1
if fuel < 1 then exit do
if fuel < 3 then
color 4
locate 1, 1 : print space$(80);
locate 1, 1 : print handl$; " you need to jump now, I'm running out of fuel!"
end if
end if
if fuel < 3 then
if planecolor = 7 then planecolor = 8 else planecolor = 7
end if
loop until jumped
if jumped then
color 4
locate 1, 1 : print space$(80);
locate 2, 1 : print space$(80);
locate 1, 1
if fuel = recede then
print "BE CAREFUL "; handl$; "!!!"
else
print handl$; " has jumped!"
end if
px = x + 1
py = y
do while v
py = py + 1
if fuel = recede then
px = px - 1
if px < 1 then
die = 2
exit do
end if
else
px = px + 1
if px > 80 then
die = 2
exit do
end if
end if
color 12
locate py, px : print chr$(2);
x = x + 1
if x > 78 then x = 1
color 7
locate y, x : print "|_^";
v = v - 1
_delay 0.5
locate py, px : print " ";
locate y, x : print space$(3);
loop
if die = 0 then
do
'this should not need screen bounds checking
py = py + 1
h = screen(py, px)
if h = 46 then die = 0 : exit do
if h = 177 then die = 1 : exit do
color 12
locate py, px : print chr$(2);
x = x + 1
if x > 78 then x = 1
color 7
locate y, x : print "|_^";
_delay 0.5
locate py, px : print " ";
locate y, x : print space$(3);
loop
end if
color 5
locate 2, 1
select case die
case 0
print "GOOD JOB "; handl$; "!!! You have landed on the grass."
case 1
print "You crashed into a building! OUCH!!!"
case 2
print "Sorry but you went out of bounds which is not the purpose of this game. "
end select
end
else
color 4
locate 1, 1 : print space$(80);
locate 1, 1 : print "Sorry but you have lost.";
color 7
do until y > 23
locate y, x : print space$(3);
y = y + 1
locate y, x : print "|_^";
_delay 0.25
loop
color 4
for i = 1 to 10
locate y, x : print "#*#";
_delay 0.125
locate y, x
if i > 7 then
print ".+.";
else
print "*#*";
end if
_delay 0.125
next
locate y, x : print space$(3);
_delay 1
end if
system
FUNCTION Random1& (maxvaluu&)
DIM sg AS INTEGER
sg% = SGN(maxvaluu&)
IF sg% = 0 THEN
Random1& = 0
ELSE
IF sg% = -1 THEN maxvaluu& = maxvaluu& * -1
Random1& = INT(RND * maxvaluu& + 1) * sg%
END IF
END FUNCTION