TGC Codebase Backup



Buzz Wire Game Media Included by Nigel _Okgo

15th Dec 2006 21:51
Summary

A Fun Buzz Wire Game, Media Included.... Simply Unzip the Media folders into the same folder as the game's .dba file, Compile it and Run it to Play the game....



Description

Move the Buzzer along the wire to reach the exit,

Programmed entirely in DBPro by
Nigel Stephen....

michaelstephenrt@hotmail.co.uk



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    set window on
show window


randomize timer()

set display mode 800,600,16
set window size 480,600

sync on
sync rate 0

hide mouse

cls rgb(0,0,0)
draw to front

dim wirex(100000)
dim wirey(100000)
dim wireshow(100000)

start:
load image "graphics/title.bmp",1
for t=1 to 8
load image "graphics/wire"+str$(t)+".bmp",t+1
next t
load image "graphics/wiretool.bmp",11
load image "graphics/toolother.bmp",12
load image "graphics/shock.bmp",13
load image "graphics/shock.bmp",14
load image "graphics/shock.bmp",15
load image "graphics/tooldetect.bmp",16
load image "graphics/chances.bmp",17
load image "graphics/base1.bmp",50
load image "graphics/base2.bmp",51

load image "graphics/title.bmp",52

load sound "sounds/buzzer.wav",1

load music "sounds/title.mid",1
load music "sounds/music1.mid",2
load music "sounds/music2.mid",3
load music "sounds/music3.mid",4
load music "sounds/music4.mid",5
load music "sounds/music5.mid",6
load music "sounds/gameover.mid",7
load music "Sounds/complete.mid",8

title:

level=0

for t=1 to 8
if music playing(t)=1 then stop music t
next t

play music 1

buzz=0
loop sound 1

titlex:
for t=1 to 1000
if sprite exist(t)=1 then delete sprite t
next t

cls rgb(0,0,0)
paste image 52,320,75,0
set window title "****Welcome to Buzz Wire****"

set text font "Westminster"
set text to bold

set text size 32

ink rgb(255,255,0),rgb(255,255,0)
text 220,275,"<Space Bar> Start a New Game"

set text size 28

ink rgb(255,255,255),rgb(255,255,255)

text 150,350,"Welcome to Buzz Wire, programmed for the PC by"
text 150,380,"Nigel Stephen...."

ink rgb(0,255,0),rgb(0,255,0)
text 150,465,"<Mouse> Controls Buzzer During Game,"
text 150,495,"<Enter> Exit Game...."

if mouseclick()=1 or inkey$()=" " then stop sound 1:goto 1

if inkey$()=chr$(13) then end

buzz=buzz+1
if buzz>20 then buzz=20
if buzz=20 then stop sound 1

ink rgb(255,255,255),rgb(255,255,255)

ty=100
for t=1 to 4
for tx=0 to 800 step 20
td=ty
ty=ty-rnd(20)+rnd(20)
if ty<80 then ty=80
if ty>120 then ty=120
line tx-20,td,tx,ty
next tx
next t

sync
goto titlex

1:

for t=1 to 1000
if sprite exist(t)=1 then delete sprite t
next t

for t=1 to 8
if music playing(t)=1 then stop music t
next t

scrx=0:scry=0

no=0
nox=20
noxx=20

x=0:y=0
xx=0:yy=0

detect=0
leveltype=0

cl=2
clx=2
tmrgo=0

for t=1 to 100000
wirex(t)=0
wirey(t)=0
wireshow(t)=0
next t

chance=15

levelx=0

level=level+1
if level=1 then lvltype=1:levelx=0:stop music 1:play music 2
if level=2 then lvltype=1:levelx=0:chance=14:stop music 2:play music 3
if level=3 then lvltype=1:levelx=0:chance=12
if level=4 then lvltype=1:levelx=0:chance=10:stop music 3:play music 4
if level=5 then lvltype=2:levelx=1:chance=8
if level=6 then lvltype=2:levelx=1:chance=5:stop music 4:play music 5
if level=7 then lvltype=2:levelx=1:chance=5
if level=8 then lvltype=2:levelx=1:chance=4:stop music 5:play music 6
if level=9 then goto complete

for ty=580 to 250 step -5
no=no+1
wirex(no)=150
wirey(no)=ty
next ty

tx=150
ty=250
si=0:sii=1

game1:

if rnd(20)=0 then si=rnd(1)

if ty<150 then si=1
if ty>450 then si=0

if si=0 then tx=tx+5:ty=ty-5
if si=1 then tx=tx+5:ty=ty+5

if tx>875 then goto game2

no=no+1
wirex(no)=tx
wirey(no)=ty

if levelx=1 then if rnd(100)=0 and tx>100 then gosub wire

goto game1
wire:

tspi=0:tspii=-5

tgo=0
tmr=0

wirex:
tmr=tmr+1:if tmr=2 then tmr=0
if tmr=0 then if rnd(20)=0 then tspi=-5+rnd(10)
rem if tmr=0 then if rnd(50)=0 then tspii=-5+rnd(10)

ty=ty+tspi
tx=tx+tspii
if tx<50 then goto wirex2

tmr=tmr+1:if tmr>50+rnd(100) then si=rnd(1):goto wirex2

no=no+1
wirex(no)=tx
wirey(no)=ty
goto wirex

wirex1:
tmr=tmr+1:if tmr=2 then tmr=0:tii=tii+1
tx=tx+tii
if ti=0 then ty=ty-5
if ti=1 then ty=ty+5
if tii>0 then goto wirex2
no=no+1
wirex(no)=tx
wirey(no)=ty
goto wirex1

wirex2:

return

game2:

for tyy=ty to 580 step 5
no=no+1
wirex(no)=tx
wirey(no)=tyy
next tyy

wirespr=1+level

xx=wirex(20)-18
yy=wirey(20)

shock=0

2:
cls rgb(0,0,0)

s=xx:d=yy

x=mousemovex()
y=mousemovey()

xx=xx+x
yy=yy+y

scrx=380-xx
scry=250-yy

if scrx>0 then scrx=0
if scrx<-225 then scrx=-225

if scry<-100 then scry=-100

set window title "Buzz Wire    Level :- "+str$(level)+"    Chances :- "+str$(chance)

if levelx=0 then paste image 50,scrx+2,scry+500,0
if levelx=1 then paste image 51,scrx+110,scry+562,0

if ok=1 then sprite no+12,-500,-500,11
if ok=0 then sprite no+12,-500,-500,13+rnd(2)
paste sprite no+12,scrx+xx,scry+yy


ok=0
spr=10
okgo=0
cl=2

tmrgo=tmrgo+1
if tmrgo=2 then tmrgo=0:clx=clx+1:if clx=9 then clx=2
cl=clx

for t=1 to no
spr=spr+1

if lvltype=2 then cl=cl-1:if cl=1 then cl=8

if lvltype=0 then sprite spr,scrx+wirex(t),scry+wirey(t),wirespr
if lvltype=1 then sprite spr,scrx+wirex(t),scry+wirey(t),8
if lvltype=2 then sprite spr,scrx+wirex(t),scry+wirey(t),cl
if lvltype=1 or lvltype=2 then if spr>noxx then sprite spr,scrx+wirex(t),scry+wirey(t),wirespr

if detect=spr then nox=spr
if nox>noxx and nox<noxx+20 then noxx=nox

rem if sprite collision(no+3,spr) then ok=1

next t

rem noxx=nox

sprite no+13,scrx+xx,scry+yy,12
sprite no+14,scrx+xx+12,scry+yy+18,16
set sprite no+14,1,1
hide sprite no+14

detect=sprite collision(no+14,0)

if detect>0 and detect<no+10 then ok=1

if ok=0 then xx=s:yy=d
if ok=0 then if sound playing(1)=0 then play sound 1:chance=chance-1
if chance=0 then goto gameover
rem if ok=1 then stop sound 1

rem sprite no+2,xx,yy,12

rem if ok=0 then xx=s:yy=d

if xx>wirex(no)-50 and xx<wirex(no)+50 and yy>wirey(no)-50 and yy<wirey(no)+50 then goto lvl

for tx=0 to (chance-1)*20 step 20
paste image 17,tx,0,0
next tx

if inkey$()=chr$(13) then end

sync
goto 2
lvl:
for t=1 to no+14
if sprite exist(t)=1 then delete sprite t
next t
goto 1

gameover:
for t=1 to 1000
if sprite exist(t)=1 then delete sprite t
next t
for t=1 to 8
if music playing(t)=1 then stop music t
next t
tmr=0
play music 7
gameoverx:
cls rgb(0,0,0)
set text font "Westminster"
set text size 64
ink rgb(255,255,196),rgb(255,255,196)
center text 400,250,"Game Over!"
ink rgb(255,255,255),rgb(255,255,255)
center text 401,249,"Game Over!"
tmr=tmr+1
if mouseclick()=1 or inkey$()=" " then goto title
sync
if tmr<40 then goto gameoverx
goto title

complete:
for t=1 to 1000
if sprite exist(t)=1 then delete sprite t
next t
for t=1 to 8
if music playing(t)=1 then stop music t
next t
tmr=0
play music 8
completex:
cls rgb(0,0,196)
ti=20
ty=480
ink rgb(255,255,255),rgb(255,255,255)
box 0,0,799,599
ink rgb(0,0,196),rgb(0,0,196)
box 2,2,794,594
ink rgb(0,255,0),rgb(0,255,0)
for t=1 to 20
ti=ti-1
ty=ty-ti
line 0,ty,800,ty
next t
for tx=0 to 900 step 20
line tx,280,tx-100,380
next tx
set text font "Westminster"
set text size 64
ink rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
center text 400,250,"****Congratulations!****"
ink rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
if rnd(2)>0 then ink rgb(255,255,0),rgb(255,255,0)
center text 401,249,"****Congratulations!****"
ink rgb(255,255,255),rgb(255,255,255)
ty=285
for t=1 to 4
for tx=0 to 800 step 20
td=ty
ty=ty-rnd(20)+rnd(20)
if ty<250 then ty=250
if ty>310 then ty=310
line tx-20,td,tx,ty
next tx
next t
tmr=tmr+1
sync
if mouseclick()=1 then play sound 1:goto title
if tmr<200 then goto completex
goto title