TGC Codebase Backup



Dragon JukeBox by dj BlackDragon

20th Jul 2004 0:40
Summary

A cool little juke box.Give me credit if you use it.



Description

A cool little juke box. Give me credit if you use it.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `Dragon Jukebox
`Author: Ian Calvert(aka dj BlackDragon)
`7/19/04

`main start screen:
cls
start$ = "Lets get Jammin! Press s to start"
start2$ = "Dragon JukeBox"
fade = 0
repeat
	set text size 40
	set text to bold
	ink rgb(055,055,255),0
	center text 300,200,start2$
	set text size 15
	set text to normal
	if fade = 0 then fadedir = 1
	if fade = 255 then fadedir = 0
	if fadedir = 1 then fade = fade + 5
	if fadedir = 0 then fade = fade - 5	
	ink rgb(fade,fade,fade),0
	center text 300,350,start$
	sync

until scancode() = 31

`music menu(type the name of the song you want in there in all spots)
cls
ink rgb(255,255,255),0
text 20,120,"Rampatrouille"
text 20,160,"(I just wanna be a) Drummer"
text 20,200,"satisfaction"

repeat
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 110) and (mousey() <=130))) then ink rgb(255,255,0),0 : text 20,120,"Rampatrouille"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 110) or (mousey() >130))) then ink rgb(255,255,255),0 : text 20,120,"Rampatrouille"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 110) and (mousey() <=130))) and (mouseclick()=1)) then goto play_song
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 150) and (mousey() <=170))) then ink rgb(255,255,0),0 : text 20,160,"(I just wanna be a) Drummer"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 150) or (mousey() >170))) then ink rgb(255,255,255),0 : text 20,160,"(I just wanna be a) Drummer"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 150) and (mousey() <=170))) and (mouseclick()=1)) then goto play_song2
if (((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 190) and (mousey() <=210))) then ink rgb(255,255,0),0 : text 20,200,"satisfaction"
if (((mousex() < 10) or (mousex() > 100)) or ((mousey() < 190) or (mousey() >210))) then ink rgb(255,255,255),0 : text 20,200,"satisfaction"
if ((((mousex() >= 10) and (mousex() <= 100)) and ((mousey() >= 190) and (mousey() <=210))) and (mouseclick()=1)) then goto play_song3
until false

`Play the song selected
play_song:
CLS
LOAD CDMUSIC 11,2
PLAY MUSIC 2
goto graphics
play_song2:
CLS
LOAD CDMUSIC 1,3
PLAY MUSIC 3
goto graphics_2
play_song3:
cls 
load cdmusic 3,5
play music 5
goto graphics_3

`lets add graphics! matrix beat thingy this could also be a screen saver
graphics:
ink rgb(055,055,255), rgb(0,0,0) : set text opaque : hide mouse
sync on : sync rate 0
this:
waitup=200 : oldx=mousex() : oldy=mousey()
cls
while scancode()<1 and mouseclick()<1
x=rnd(640) : y=rnd(400)
set cursor x,y : a=rnd(1) : wait 5 : print a
set cursor x,y+15 : a=rnd(1) : wait 5 : print a
set cursor x,y+30 : a=rnd(1) : wait 5 : print a
set cursor x,y+45 : a=rnd(1) : wait 5 : print a
set cursor x,y+60 : a=rnd(1) : wait 5 : print a
set cursor 0, 460
print " "
dec waitup,1
if waitup<0 then goto this
sync
endwhile

`graphics 2 the second color matrix style beat thingy
graphics_2:
ink rgb(0,255,0), rgb(0,0,0) : set text opaque : hide mouse
sync on : sync rate 0
here2:
waitup=200 : oldx=mousex() : oldy=mousey()
cls
while scancode()<1 and mouseclick()<1
x=rnd(640) : y=rnd(400)
set cursor x,y : a=rnd(1) : wait 5 : print a
set cursor x,y+15 : a=rnd(1) : wait 5 : print a
set cursor x,y+30 : a=rnd(1) : wait 5 : print a
set cursor x,y+45 : a=rnd(1) : wait 5 : print a
set cursor x,y+60 : a=rnd(1) : wait 5 : print a
set cursor 0, 460
print " "
dec waitup,1
if waitup<0 then goto here2
sync
endwhile

`graphics 3 which is 3d bouncing boxes
graphics_3:


rem set sync rate
sync on : sync rate 20
hide mouse

rem number of cubes to see
numobjects=4

rem red/blue only flag
redblueonly=0

rem size of cubes
size=100/numobjects

rem red/blue separation factor
sep#=0.055

rem z offset of world
zoffset=200

rem x,y,z point of a cube
dim x(numobjects)
dim y(numobjects)
dim z(numobjects)

rem x,y,z direction forward or back of each axis
dim xdir(numobjects)
dim ydir(numobjects)
dim zdir(numobjects)

rem speed of each axis
dim xspd(numobjects)
dim yspd(numobjects)
dim zspd(numobjects)

rem spin
dim spinspd(numobjects)
dim spin(numobjects)

for i=0 to numobjects-1

  rem start each object in a random direction
  xdir(i)=rnd(1)
  ydir(i)=rnd(1)
  zdir(i)=rnd(1)

  rem start each object at a random position
  x(i)=rnd(300)-150
  y(i)=rnd(300)-150
  z(i)=rnd(300)-150

  rem start each object at a random speed
  xspd(i)=rnd(5)+2
  yspd(i)=rnd(5)+2
  zspd(i)=rnd(5)+2

  rem start spin
  spinspd(i)=rnd(5)
  spin(i)=rnd(360)

next i


rem create the objects
for i=0 to numobjects-1

  rem make objects
  make object cube i*2+1, size
  make object cube i*2+2, size

  rem color objects
  color object i*2+1, rgb(255, 0, 0)
  color object i*2+2, rgb(0, 0, 255)

  rem make object transparent
  ghost object on i*2+1
  ghost object on i*2+2

next i

rem set background to black
color backdrop rgb(0,0,0)
sync

do

if escapekey() then break

rem move each object a little bit
for i=0 to numobjects-1

  rem calculate a new position for object
  if xdir(i)=1 then x(i)=x(i)+xspd(i) else x(i)=x(i)-xspd(i)
  if ydir(i)=1 then y(i)=y(i)+yspd(i) else y(i)=y(i)-yspd(i)
  if zdir(i)=1 then z(i)=z(i)+zspd(i) else z(i)=z(i)-zspd(i)

  rem bounds check (bounce if out of bounds)
  bounce=0
  if x(i)>100 then x(i)=100 : xdir(i)=0 : xspd(i)=rnd(5)+2 : bounce=1
  if x(i)<-100 then x(i)=-100 : xdir(i)=1 : xspd(i)=rnd(5)+2 : bounce=1
  if y(i)>75 then y(i)=75 : ydir(i)=0 : yspd(i)=rnd(5)+2 : bounce=1
  if y(i)<-50 then y(i)=-50 : ydir(i)=1 : yspd(i)=rnd(5)+2 : bounce=1
  if z(i)>250 then z(i)=250 : zdir(i)=0 : zspd(i)=rnd(5)+2 : bounce=1
  if z(i)<-125 then z(i)=-125 : zdir(i)=1 : zspd(i)=rnd(5)+2 : bounce=1

  rem if bounce change color
  if bounce

`color
    r=210+rnd(255-210)
    
    b=rnd(255-128)+128
    if (b+g)<200 then b=200-g

    rem color objects
    if redblueonly
      color object i*2+1, rgb(r, 0, 0)
      color object i*2+2, rgb(0,055, b)
    else
      color object i*2+1, rgb(r, 0, 0)
      color object i*2+2, rgb(0, g, b)
    endif

    rem if bounce change spin speed
    spinspd(i)=rnd(5)

  endif

  rem set object to new calculated position
  position object i*2+1, (0-z(i))*sep#+x(i),y(i),z(i)+zoffset
  position object i*2+2, x(i),y(i),z(i)+zoffset

  rem spin the object a little bit
  spin(i)=wrapvalue(spin(i)+spinspd(i))

  rem make object spin every direction
  rotate object i*2+1, spin(i), spin(i), spin(i)
  rotate object i*2+2, spin(i), spin(i), spin(i)

next i

rem update screen
sync

loop