TGC Codebase Backup



BallRoom Dancing by Lenny Briscoe

19th Jul 2004 1:13
Summary

BallRoom Dancing - 3D Balls dance in space



Description

This is a little demo I knocked out years ago in Db Classic. It will run in all versions of DB. BallRoom Dancing, made a man of me...



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    sync on
sync rate 60
hide mouse
randomize timer()

autocam on
create bitmap 1,256,256
r=0
ink rgb(0,0,0),0
box 0,0,254,254
for xy = 0 to 254 step 32
   ink rgb(255,255,250),0
   line xy,0,xy,255
   line 0,xy,255,xy
   ink rgb(250,260,220),0
   line xy+1,0,xy+1,255
   line 0,xy+1,255,xy+1
next xy
get image 2,0,0,255,255

ink rgb(0,0,0),0
box 0,0,254,254
get image 3,0,0,255,255

make object sphere 1,2
ghost object on 1
make object sphere 4,2
set object 4,0,0,0
make object sphere 3,2
scale object 3,100,100,100
texture object 3,3
ghost object on 3
for i = 20 to 30
make object sphere i,2
set object i,0,1,1,1,1
position object i,rnd(10),rnd(100),rnd(50)
next i
make object sphere 2,20
set object 2,1,1,0
texture object 2,2
ghost object on 2
make object sphere 32,20
set object 32,1,1,0
texture object 32,2
make object sphere 33,30
set object 33,1,1,0
texture object 33,2
ghost object on 33
position camera 0,-2,10
point camera 0,-2,0
   set current bitmap 0
color backdrop rgb(0,0,0)
rot# = 3
val#=.1
hal#=-.06
set ambient light 0
make light 1
set directional light 1,0,-1,0
color light 1,rgb(20,50,250)
make light 2
set directional light 2,0,1,0
color light 2,rgb(200,50,50)
make light 3
set directional light 3,0,0,0
color light 3,rgb(200,50,50)
fog on
fog distance 1000
fog color rgb(200,200,200)
position camera 0,-1,0
load music "round.mid",1
loop music 1
do

   if object position y(1) < -19 and check = 0
      vscale#=vscale#+6
      vv#=vscale#/1000.0
      y#=y#-vv#
      sss#=1
      val#=0
      if vscale#>40
         val#=.1
         check = 1
color light 2,rgb(rnd(255),rnd(255),rnd(255))
color light 3,rgb(rnd(255),rnd(255),rnd(255))
color light 1,rgb(rnd(255),rnd(255),rnd(255))
fog color rgb(rnd(255),rnd(255),rnd(255))
color object 1,rgb(rnd(255),rnd(255),rnd(255))
scale object 2,rnd(3000),rnd(3000),rnd(3000)
scale object 32,rnd(4000),rnd(2000),rnd(5000)
scale object 33,rnd(4000),rnd(2000),rnd(5000)
for i=20 to 30
color object i,rgb(rnd(255),rnd(255),rnd(255))
position object i,x#+rnd(50),y#+rnd(50),rnd(10)
next i
rem position camera rnd(30),rnd(30),rnd(30)
      endif
      else
      if vscale#>0
         vscale#=vscale#-16
         if vscale#<=0 then vscale#=0:vv#=0:check = 0
      endif
   endif
   if object position y(1) > 3 then val#=-.1
   if object position x(1) < -19 then rot# = 3:hal#=.06
   if object position x(1) > 19 then rot# =  -3:hal#=-.06
   y#=y#+val#
   x#=x#+hal#
   scale object 1,100,100.0-vscale#,100
   scale object 4,100,100.0-vscale#,100
   position object 1,x#,y#,-5
position object 32,x#,y#,-5
   position object 4,x#,y#,5
   ink rnd(255),0
   dot x#,y#
   point camera x#,y#,-5
   position object 3,x#,-9.95,-5
   position light 3,x#,y#,-50
if camr=0 then camran=camran+1
if camr=1 then camran=camran-1
   if camran>150 then camr=1
   if camran<-150 then camr=0

 position camera x#,y#,camran
   point light 3,x#,y#,-5
   rot1#=wrapvalue(rot1#+rot#)
   rot2#=wrapvalue(rot1#*rot#)
   yrotate object 1,rot1#
   yrotate object 4,rot2#
   yrotate object 2,rot1#
   yrotate object 32,rot1#
   zrotate camera rot1#
zrotate object 33,rot1#
   yrotate object 3,rot1#
   for i=20 to 30
   yrotate object i,rot1#
   next i
   s# = object position y(1) + 9.95
   xsc# = 100 - (s# * 2.0)
   scale object 3,xsc#+vscale#,.001,xsc#+vscale#
   sync
   loop