how do i set music volume to a slider?
Offline
If you want to know how to set the value, check out my (jontmy00; my alt) project that was remixed here.
Offline
You can also use a sprite to make a slider. Choose a length of slider, x. This can be anywhere from 2 pixels to 480 pixels, though the larger it is the more control the player has on setting the sound. Now define where the slider is, for example my slider will be 120 pixels long, and will be in position x=0 to x=120. The y co-ordinate is irrelevant. Now construct a script on the slider sprite, the slider should be something like a small circle the player can drag.
Forever If <<touching [mouse-pointer v]?> and <mouse down?>> if <<(mouse x) > (-1)> and <(mouse x) < (181)>> Set x to (mouse x) end end if <(x position) < (0)> Set x to (0) end if <(x position) > (180)> Set x to (180) endThis will make the slider go to the mouse within the confines of the boundary we defined, in this case 0 to 180 (note how to allow x=0 and x=180 I set the confines to x=-1 and x=181).
(((x position) / (180)) * (100))If your slider doesn't start at x=0, we'll need to change the script a bit, this time the length is still 180, but starts at x=20 and ends at x=200:
((((x position) - (20)) / (180)) * (100))And thus the general formula for ANY starting x=n and length=l becomes:
((((x position) - (n)) / (l)) * (100))Set the volume % to this value and then you have a slider
Set volume to ((((x position) - (n)) / (l)) * (100)) %I hope this helps
Last edited by Prestige (2012-07-19 08:03:57)
Offline