how to create a controller for the volume?
venon_it
Member, PRO Posts: 594
Hi,
i want to create a controller for volume...
know how to do?
Thankkssss
i want to create a controller for volume...
know how to do?
Thankkssss
Comments
click on options from the main menu:
http://gamesalad.com/game/play/30122
What are the settings fot it??
Thanksssss
Ok, here you go:
You need a global game attribute (real) called musicVolume.
In the slider, you need a boolean attribute called "dragging".
You also need 2 attributes (real) called leftLimit and rightLimit.
(those are the left and right boundaries of the slider.)
You need 5 separate rules in the slider:
1. When you click on the slider, change "dragging" to TRUE.
2. When you release the mouse, change "dragging" to FALSE.
3. When "clicked" = TRUE
self.PositionX = Mouse.PositionX
4. When self.PositionX <= leftLimit
self.PositionX = leftLimit
5. When self.PositionX >= rightLimit
self.PositionX = rightLimit
Finally, you need to use Constrain Attribute:
game.musicVolume = floor( self.Position.X - self.leftLimit )/(self.rightLimit - self.leftLimit)
And, if you want live feedback:
Constrain Attribute:
game.Audio.Volume To: game.musicVolume
Hope this helps!
thankssss, i try but don't function... i create a GS and add here : http://gamesalad.com/game/play/30189
you can download it and if you want modify the example?
could be helpful to many users
Thanksss a lot
I created a demo for you. It's fully commented, feel free to use it for whatever you need.
http://gamesalad.com/game/play/30207
Best,
Joe