TGC Codebase Backup



Rocket by Gillypie

15th Apr 2005 15:15
Summary

A neat little program that is ideal for people who are new to dark basic.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    LOAD SOUND "explosion.wav",1
Load Music "Music03.mid",1
beggin:
Play music 1
sync rate 200

t=100:tb=50:l=2
x=325:y=150
Hide Mouse
CLS
Gosub drawrocket

set text size t
center text 320,10,"Rocket"
set text size tb
center text 320,400,"Press Space Bar To Launch"
wait key
y=250

INPUT "Enter time limit ";time#
 
Sync on

DO
CLS
y=y-3
Gosub drawrocket
IF y<-100 then GOTO wattup
sync
Loop

wattup:
DIM bx(10000):DIM by(10000)


start:
y=400:x=250
l=1:b=0:s=0:a=1:q=0:p#=0


f=1:g=1:ex=50:ey=50


DO
q=q+1
if q=100
time#=time#-1
q=0
Endif
if time#=0 then goto end
CLS
circle 15,15,50
Print time#
Print p#

GOSUB DrawROCKET
GOSUB Drawbad
if leftkey()=1 then x=x-5
if rightkey()=1 then x=x+5
if upkey()=1 then y=y-5
if downkey()=1 then y=y+5

if x<-40 then x=690
if x>690 then x=-40
if y<-70 then y=520
if y>520 then y=-70


If s<20 then Goto NoBullet
Gosub Createbullet
Nobullet:
s=s+1
If s>20 then s=0
Gosub Drawbullet
If b>9999 then goto start
sync
Loop

drawrocket:
LINE x,y,(x+(l*10)),(y+(l*10))
LINE (x+(l*10)),(y+(l*10)),(x+(l*10)),(y+(l*60))
LINE (x+(l*10)),(y+(l*60)),(x+(l*20)),(y+(l*70))
LINE (x+(l*20)),(y+(l*70)),(x-(l*10)),(y+(l*70))
LINE (x-(l*10)),(y+(l*70)),(x+(l*10)),(y+(l*70))
LINE x,y,(x-(l*10)),(y+(l*10))
LINE (x-(l*10)),(y+(l*10)),(x-(l*10)),(y+(l*60))
LINE (x-(l*10)),(y+(l*60)),(x-(l*20)),(y+(l*70))
LINE (x-(l*20)),(y+(l*70)),(x-(l*10)),(y+(l*70))
LINE (x+(l*10)),(y+(l*10)),(x+(l*40)),(y+(l*60))
LINE (x+(l*40)),(y+(l*60)),(x+(l*10)),(y+(l*60))
LINE (x-(l*10)),(y+(l*10)),(x-(l*40)),(y+(l*60))
LINE (x-(l*40)),(y+(l*60)),(x-(l*10)),(y+(l*60))
LINE (x+(l*10)),(y+(l*10)),(x-(l*10)),(y+(l*10))
Return

Createbullet:
If spacekey()=1
b=b+1
bx(b)=x:by(b)=y
endif
Return

drawbullet:
for c=a to b
circle bx(c),by(c),2
by(c)=by(c)-10
If by(c)<0 then a=a+1

If bx(c)>=ex and bx(c)<=(ex+20) and by(c)>=ey and by(c)<=(ey+20)
PLAY SOUND 1
p#=p#+1
ink rgb(rnd(255),rnd(255),rnd(255)),1
endif
next c
Return

Drawbad:
If ex>615 or ex<20 then f=f*(-1)
If ey>450 or ey<20 then g=g*(-1)
d=f*3:e=g*3
ex=ex+d:ey=ey+e
BOX ex,ey,(ex+10),(ey+10)
Return

end:
DO
CLS
PRINT "FINAL SCORE = ";
print p#
center text 320,30,"Darn your out of time"
center text 320,250,"Press 'Enter' to replay"
if returnkey()=1 then goto beggin
sync
LOOP