TGC Codebase Backup



CD Player(simple but no bugs) by LinkTidus

30th Apr 2006 12:01
Summary

Yes it's VERY simple, but we're working on it this is just are ALPHA version so keep updated



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    print "Welcome to the Fronzco CD Player"
wait key


print "Click any key at any time to go to your next track"
wait key


load cdmusic 1,1 : loop music 1

play music 1




print "Now playing track 1"
wait key

stop music 1

load cdmusic 2,2 : loop music 1

play music 2

print "Now playing track 2"
wait key

stop music 2

load cdmusic 3,5 : loop music 1

play music 5


print "Now playing track 3"
wait key

stop music 5

load cdmusic 4,6 : loop music 1

play music 6

print "Now playing track 4"
wait key

stop music 6

load cdmusic 5,7 : loop music 1

play music 7

print "Now playing track 5"
wait key

stop music 7

load cdmusic 6,8

play music 8

print "Now playing track 6"
wait key

stop music 8

load cdmusic 7,3

play music 3

print "Now playing track 7"
wait key

stop music 3

load cdmusic 8,4

play music 4

print "Now playing track 8"
wait key

stop music 4

load cdmusic 9,9

play music 9

print "Now playing track 9"
wait key

stop music 9

load cdmusic 10,10

play music 10

print "Now playing track 10"
wait key

stop music 10

load cdmusic 11,11

play music 11

print "Now playing track 11"
wait key

stop music 11

load cdmusic 12,12

play music 12

print "Now playing track 12"
wait key

stop music 12

load cdmusic 13,13

play music 13

print "Now playing track 13"
wait key

stop music 13

load cdmusic 14,14

play music 14

print "Now playing track 14"
wait key

stop music 14

load cdmusic 15,15

play music 15

print "Now playing track 15"
wait key

print "Thankyou for using our CD Player we are releasing 30 track cd play so keep updated on our software"
wait key
print "Press any keys for future visualisations(only 1 but thanks to 'anymous coder'"
wait key


sync on
sync rate 25
hide mouse
autocam off
position camera 0,5,0
color backdrop rgb(100,100,155)
fog on
fog color rgb(100,100,155)
fog distance 2000

`grass
for x=1 to 10
for y=1 to 10
ink rgb(rnd(100),rnd(155)+100,0),0
dot x,y
next y
next x
get image 1000,1,1,10,10
make object plain 1000,2000,2000
xrotate object 1000,-90
texture object 1000,1000
scale object texture 1000,10,10
set object texture 1000,2,0

`particle properties
numberofparticles=10000
dim x#(numberofparticles)
dim y#(numberofparticles)
dim xspeed#(numberofparticles)
dim yspeed#(numberofparticles)
dim brightness(numberofparticles)
dim a#(numberofparticles)
dim e#(numberofparticles) `phase angle
for particle=1 to numberofparticles
x#(particle)=rnd(screen width())
y#(particle)=rnd(screen height())
xspeed#(particle)=(rnd(3000)/1000.0)
e#(particle)=rnd(360)
brightness(particle)=rnd(100)+100
a#(particle)=gaussian(2*screen width())-screen width() `amplitude
gravitya#=.01
gravityb#=1.0
omega#=0.0006 `primary angular velocity
phi#=2.0 `secondary angular velocity
next particle

do
inc counter
if counter>1000 then counter=0
if counter=100 or counter=110 or counter=400
color backdrop rgb(255,255,255)
else
color backdrop rgb(100,100,155)
endif

gosub particles
control camera using arrowkeys 0,1,1
if counter/2.0=int(counter/2.0) then sync
loop

particles:

text 0,0,str$(screen fps())
lock pixels

`tornado particles
for particle=1 to numberofparticles step 2
inc y#(particle),gravityb#
if y#(particle)>0 and y#(particle)<screen height() and x#(particle)>0 and x#(particle)<screen width() then set_locked_pixel(x#(particle),y#(particle),rgb(brightness(particle),brightness(particle),200))
x#(particle)=(500/y#(particle)^1.5)*a#(particle)*sin(theta#+e#(particle))+screen width()/2+(20*sin(y#(particle)+psi#))
theta#=wrapvalue(theta#)+omega#
if y#(particle)>=screen height()/1.5 then dec y#(particle),screen height()
next particle
psi#=wrapvalue(psi#)+phi#

`background particles
for particle=2 to numberofparticles step 2
inc y#(particle),gravityb#
if y#(particle)>screen height()-1 then y#(particle)=1
if y#(particle)>0 and y#(particle)<screen height() and x#(particle)>0 and x#(particle)<screen width() then set_locked_pixel(x#(particle),y#(particle),rgb(brightness(particle),brightness(particle),200))
inc x#(particle),xspeed#(particle)
if x#(particle)>screen width()-1 then x#(particle)=1
next particle
unlock pixels
return

`Function borrowed from Coding Fodder's Rain code
function set_locked_pixel(x,y,color_value)
   start=get pixels pointer()
   repeat_number=get pixels pitch()
   bits_per_pixel=bitmap depth(num)/8
   pointer=start+y*repeat_number+x*bits_per_pixel
   *pointer=color_value
endfunction



function gaussian(range#)

   r=0
   for a = 1 to range#/10
      inc r, rnd(range#)
   next a

   r=int(10*r/range#)

endFunction r