`=========================================
`========Alex's Gold catching game========
`=======DarkBASIC Coding Challenges=======
`=========================================
level=1
sync on
`the menu
gosub imagemaking
menu:
cls
ink rgb(0,0,255),0
box 0,0,639,479
set text size 70
set text font "impact"
ink rgb(255,200,0),0
center text 320,50,"Gold Catching II"
set text size 20
ink rgb(200,145,0),0
center text 320,120,"By INH (With lots of assistance from LBFN)"
box 260,170,380,240
 
box 260,270,380,340
ink rgb(0,0,0),0
set text size 60
center text 320,175,"Play"
set text size 30
center text 320,275,"How to play"
set text size 20
center text 320,310,"(Read this first)"
sync on
do
if mousex()>260 and mousey()>170 and mousex()<380 and mousey()<240 and mouseclick()=1 then goto game
if mousex()>260 and mousey()>270 and mousex()<380 and mousey()<340 and mouseclick()=1 then gosub help
sprite 2,0,bp,2
sprite 3,60,bp,6
sprite 4,610,bp,2
sprite 5,550,bp,5
bp=bp+5 
if bp>480 then bp=0
sprite 1,mp,400,1
if left=0 then mp=mp+3
if left=1 then mp=mp-3
if mp>600 then left=1
if mp<5 then left=0
sync
loop
help:
delete sprite 2
delete sprite 3
delete sprite 4
delete sprite 5
cls
ink rgb(50,50,50),0
box 0,0,639,479
ink rgb(200,200,200),0
set text size 60
center text 320,0,"Help"
set text size 20
center text 320,60,"You take the role of Bob Less. He and his wife Penny are in huge debt and need quick cash. One"
center text 320,80,"day while Bob is working in the warehouse, boxes full of gold start to rain from the ceiling."
center text 320,100,"This is exactly what Bob and Penny need. Each box is worth £10,000!"
center text 320,140,"Move Bob with the mouse. Forty-five boxes will rain from the ceiling, and you need £300,000 to get"
center text 320,160,"On to the next level. Be warned! On each new level the boxes drop faster!"
center text 320,180,"Sometimes small white and red powerups will appear. Collect them and the boxes will slow down."
center text 320,220,"Other times take a chance boxes (TAC) with rain from the sky. They might give you money, or they"
center text 320,200,"Bill boxes will come down too. These will minus £10000 from you."
center text 320,240,"Might be a bill!"
center text 320,260,"As you progress through the levels you will come across special levels. The added rules for these"
center text 320,280,"will be explained then."
center text 320,300,"Press space to go back."
do
if spacekey()=1 then cls : goto menu
sync
loop
 
 
game:
cls
delete sprite 3
delete sprite 4
delete sprite 5
delete sprite 1
hide mouse
`main loop
powerup=level+9
ispt=100000
boxslow=-1
ink rgb(70,50,20),0
box 0,300,639,479
ink rgb(50,30,0),0
box 0,0,639,300
ink rgb(100,100,255),0
box 0,0,60,49
box 300,0,639,49
ink rgb(0,0,0),0
get image 999,0,0,70,60
sprite 10,60,0,10
sn=50
gsp=60
do
set cursor 0,0
print "Gold - o -"
set cursor 0,25
print "£",score
set cursor 400,0
print "You are on Level ",level
 
`man
position mouse mousex(),350
sprite 1,mousex(),mousey(),1
gosub gold
gosub powerups
gosub bills
gosub tac
gosub weights
sync
loop
 
 
`man
gold:
if sp=1 then byp=byp+powerup : sprite 2,c,byp,2
if sp=0 then c=rnd(600) : sprite 2,c,0,2 : sp=1
if byp>350 then sp=0 : gosub check
if goes=40 then sync off : gosub finish
return
powerups:
itap=rnd(100)
if itap=5 and boxslow<0 then pp=rnd(600) : sprite 3,pp,0,3 : ipst=0
ipst=ipst+20
if ipst>370 then ipst=1000 : delete sprite 3
if ipst<1000 then sprite 3,pp,ipst,3
if mousex()>pp-25 and mousex()<pp+25 and ipst>300 and ipst<1000 then powerup=5 : boxslow=200 : delete sprite 3 : ipst=1000
boxslow=boxslow-1
if boxslow=0 then powerup=10
return
bills:
if billthere=0 and gsp>=70 then billbe=rnd(100)
if billbe=1 then billthere=1 : bpp=rnd(600) : billbe=0
if billthere=1 then bppp=bppp+powerup : sprite 5,bpp,bppp,5
if bppp>350 then billthere=0 : delete sprite 5 : gosub checkbills
return
tac:
if tacthere=0 and gsp>=70 then tacbe=rnd(100)
if tacbe=1 then tacthere=1 : tpp=rnd(600) : tacbe=0
if tacthere=1 then tppp=tppp+powerup : sprite 6,tpp,tppp,6
if tppp>350 then tacthere=0 : delete sprite 6 : gosub checktac
return
weights:
if wthere=0 then wbe=rnd(100)
if wbe=1 then wthere=1 : wpp=rnd(600) : wbe=0
if wthere=1 then wppp=wppp+powerup : sprite 7,wpp,wppp,7
if wppp>350 then wthere=0 : delete sprite 7 : gosub checkw
return
`check
check:
goes=goes+1
if c>mousex() and c<mousex()+54 
score=score+10000 : paste image 999,0,0 : sprite sn,gsp,25,11 : sn=sn+1 : gsp=gsp+10
endif
byp=0
 
return
checkbills:
if bpp>mousex() and bpp<mousex()+54 then score=score-10000 : paste image 999,0,0 : sn=sn-1 : delete sprite sn : gsp=gsp-10
 
 
 
bppp=0
return
 
checktac:
wwib=50
if tpp>mousex() and tpp<mousex()+54 then wwib=rnd(1)
if wwib=0 then score=score-10000 : sn=sn-1 : delete sprite sn : gsp=gsp-10
if wwib=1 then score=score+10000 : paste image 999,0,0 : sprite sn,gsp,25,11 : sn=sn+1 : gsp=gsp+10
 
 
 
 
wait 1*10
paste image 999,0,0
tppp=0
return
 
checkw:
if wpp>mousex()-54 and wpp<mousex()+54 
sync off
for d=1 to 999
if sprite exist(d) then delete sprite d
next d
for d=1 to 999
if sprite exist(d) then delete sprite d
next d
cls
ink rgb(255,255,255),0
sprite 9,mousex(),350,9
sync off
set cursor 200,80
ink rgb(255,255,255),0
score=0
goes=0
wppp=100000
sn=11
print "Oh dear, Bob was crushed. Play again?(y/n)"
sync on
set cursor 0,0
do
if inkey$()="y" then delete sprite 9 : wpp=0 : wppp=0 : goto game
if inkey$()="n" then end
sync
loop
endif
wppp=0
return
 
finish:
sn=11
sync off
for d=1 to 999
if sprite exist(d) then delete sprite d
next d
for d=1 to 999
if sprite exist(d) then delete sprite d
next d
cls
box 0,0,639,479
set cursor 240,50
ink rgb(255,255,255),0
print "You scored £",score,"!"
set cursor 100,65
if score<300000 then print "That is not enough to get you out of debt, but you got to level",level,". You need another £",300000-score,". Try again?(y/n)" : level=1
set cursor 40,65
if score>=300000 then print "That is enough to get you on to the next level, with an extra £",score-300000,"! Play next level?(y/n)" : level=level+1
set cursor 250,80
score=0
goes=0
sync on
do
set cursor 0,0
if inkey$()="y" then cls : goto game
if inkey$()="n" then end
loop
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
`MAKE IMAGES
imagemaking:
`make deadbob
ink rgb(10,10,10),0
for t=0 to 6
circle 30,14,t
next t
ink rgb(255,200,200),0
for t=0 to 6
circle 30,16,t
next t
ink rgb(40,40,40),0
box 27,15,27,15
box 28,16,28,16
box 26,16,26,16
box 28,14,28,14
box 26,14,26,14
box 32,15,32,15
box 31,14,31,14
box 31,16,31,16
box 33,14,33,14
box 33,16,33,16
box 29,19,31,20
ink rgb(0,0,200),0
box 22,23,38,28
ink rgb(50,200,200),0
box 22,29,38,32
box 22,32,28,38
box 32,32,38,38
ink rgb(255,200,200),0
box 38,23,42,27
box 18,23,22,27
get image 9,0,0,54,66,9
cls
 
 
 
`make weights
ink rgb(100,100,100),0
circle 20,20,10
circle 20,20,12
circle 20,20,13
box 0,20,40,60
ink rgb(255,255,255),0
set cursor 10,20
print "10"
set cursor 4,35
print "Tons"
get image 7,0,0,40,60
cls
 
 
`make powerups
for p=0 to 7
circle 10,10,p
if p=2 then ink rgb(255,255,255),0
next p
get image 3,0,0,50,50
cls
 
`make the little man
ink rgb(10,10,10),0
for t=0 to 6
circle 30,14,t
next t
ink rgb(255,200,200),0
for t=0 to 6
circle 30,16,t
next t
ink rgb(40,40,40),0
box 27,12,28,13
box 32,12,33,13
box 29,16,31,18
ink rgb(0,0,200),0
box 22,23,38,41
ink rgb(50,200,200),0
box 22,41,38,46
box 22,46,28,66
box 32,46,38,66
ink rgb(255,200,200),0
box 38,23,54,27
box 6,23,22,27
get image 1,0,0,54,66
cls
 
 
 
`make the boxes
ink rgb(160,100,50),0
box 0,0,30,30
ink rgb(190,140,50),0
box 3,3,27,27
ink rgb(10,10,10),0
set cursor 0,7
print "Gold"
get image 2,0,0,30,30
cls
 
`make take a chances
ink rgb(160,100,50),0
box 0,0,30,30
ink rgb(190,140,50),0
box 3,3,27,27
ink rgb(0,250,0),0
set cursor 2,7
print "TAC"
get image 6,0,0,30,30
cls
 
`make bills
ink rgb(160,100,50),0
box 0,0,30,30
ink rgb(190,140,50),0
box 3,3,27,27
ink rgb(200,0,0),0
set cursor 3,7
print "Bill"
get image 5,0,0,30,30
cls
 
 
`make hud
ink rgb(100,100,255),0
box 0,0,300,50
ink rgb(10,10,10),0
print "Meter 2000"
set cursor 296,25
ink rgb(255,10,10),0
print "\/"
get image 10,0,0,310,50
cls
 
`make yellowpart
ink rgb(10,4,4),0
box 0,0,10,25
ink rgb(255,255,4),0
box 1,1,8,24
 
get image 11,0,0,10,25
cls
return