Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
SceneList
MostFramesScript
goMU LDM
Shiver With Sound
Noise Algorithm 2
PDF files on the fly
Creating a Game Environment
simMode2.0 Xtra
Fade In Out Text
OnWine – shocking in all dimensions
MediaMacros Xtras Mall
 

 

 

Behavior Volume Control Dial

Added on 4/27/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: BrentMoseley

You can define the following: How much the sprite will rotate when the mouse is moved. How much the volume changes when the sprite rotates. Which direction the sprite rotates in relation to mouse movement. The initial volume of the sound channel and of course, which sound channel to change.

--created April 26th, by Brent Moseley.
--brent099@xoommail.com

property mysprite
property startrot
property startsound
property clicked
property startv

property motiondiv
property mychannel
property volmult
property inversed
property initvol

on beginsprite me
  mysprite = the spritenum of me
  startrot = the rotation of sprite mysprite
  the volume of sound mychannel = initvol
end

on mousedown me
  startrot = the rotation of sprite mysprite
  startv = the mousev
  startsound = the volume of sound mychannel
  clicked = true
end

on prepareframe me
  if the mousedown = true then
    if clicked = true then
      
      if inversed = false then  --sets DIST to the distance the mouse has moved divided by motiondiv.
        dist = (startv - the mousev) / motiondiv
      else
        dist = (the mousev - startv) / motiondiv
      end if
      
      
      the rotation of sprite mysprite = startrot + dist  --adds DIST to the sprite"s starting rotation.
      
      --sets the volume to the starting volume + the amount the sprite has rotated * volmult.
      the volume of sound mychannel = startsound + ¬
      ((the rotation of sprite mysprite - startrot) * volmult)
      
    end if
  else if clicked = true then
    clicked = false
  end if
end




on getPropertyDescriptionList me
  set pdlist to [:]
  addprop pdlist, #motiondiv, [#comment:"mouse movement to sprite rotation ratio.¬
smaller is faster", #format:#float, #default:2]
  addprop pdlist, #volmult, [#comment:"volume change to sprite rotation ratio.¬
heigher is more drastic", #format:#float, #default:3]
  addprop pdlist, #inversed, [#comment:"reverse rotation direction.", #format:#boolean, #default:0]
  addprop pdlist, #mychannel, [#comment:"sound channel", #format:#integer, #default:1]
  addprop pdlist, #initvol, [#comment:"Initial volume level.", #format:#integer, #default:255, #range:[#min: 0, #max: 255]]
  return pdlist
end getPropertyDescriptionList


on getBehaviorDescription
  return "Volume control dial." & return & return & ¬
"Changes the volume of a sound channel based on the rotation of a sprite." & return & return &¬
"Drop onto a sprite and select the sound channel to change."
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail