home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / sound / sound1-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  1.9 KB  |  88 lines

  1. rem Sound Showcase
  2.  
  3. rem Standard Setup Code for all examples
  4. sync on : sync rate 0 : backdrop off
  5. set text font "arial" : set text size 16
  6. set text to bold : set text transparent
  7.  
  8. rem Loading prompt
  9. sync : center text screen width()/2,screen height()/2,"LOADING" : sync
  10.  
  11. rem Load room
  12. load object "world\room.x",1
  13. xrotate object 1,270
  14. fix object pivot 1
  15. rotate object 1,0,180,0
  16. set object specular 1,0
  17.  
  18. rem Load selectors
  19. for t=2 to 5
  20.  load object "models\notes\notes.x",t
  21.  position object t,-100,32,40-(((t-3)*80))
  22.  rotate object t,270,90,0
  23.  scale object t,50,50,50
  24.  fix object pivot t
  25.  rotate object t,0,0,0
  26.  set object specular t,0
  27. next t
  28.  
  29. rem Load sound
  30. load sound "sound\ghost.wav",1
  31. load sound "sound\hit.wav",2
  32. load sound "sound\smash.wav",3
  33. load sound "sound\tube.wav",4
  34.  
  35. rem Setup camera and light
  36. set point light 0,0,0,0
  37. position camera -450,100,10
  38. set camera fov 45
  39. yrotate camera 90
  40.  
  41. rem Select first note (via Xangle trigger)
  42. yrotate object 2,1
  43.  
  44. rem Main loop
  45. desc$="Sound Room (Select A Note)"
  46. do
  47.  
  48. rem Control mouse selector
  49. if mouseclick()=1
  50.  sel=0
  51.  if mousex()>70 and mousex()<600
  52.    sel=1+((mousex()-70)/(530/4))
  53.    if sel>4 then sel=4
  54.  endif
  55.  if sel>0
  56.   if object angle y(1+sel)=0
  57.    yrotate object 1+sel,1
  58.    if sel=1 then play sound 1
  59.    if sel=2 then play sound 2
  60.    if sel=3 then play sound 3
  61.    if sel=4 then play sound 4
  62.   endif
  63.  endif
  64. endif
  65.  
  66. rem Control selected
  67. for pace=0 to 9
  68.  for t=2 to 5
  69.   if object angle y(t)>0 then rotate object t,0,wrapvalue(object angle y(t)+1),0
  70.   if object angle y(t)>0 then lightz#=object position z(t) : lighty#=object position y(t)
  71.  next t
  72. next pace
  73.  
  74. rem Control light
  75. position light 0,-200,lighty#,lightz#
  76.  
  77. rem Show Framerate
  78. text 20,screen height()-40,desc$
  79. fps$="DBPro Fps: "+str$(screen fps())
  80. text screen width()-20-text width(fps$),screen height()-40,fps$
  81.  
  82. rem Update screen
  83. sync
  84.  
  85. rem End loop
  86. loop
  87.  
  88.