Volume Controlled by Slider?

Non-platform specific questions.

Volume Controlled by Slider?

Postby NyahKitty » Tue Dec 20, 2005 7:14 pm

I'm trying to set up a graphical volume control based on the y axis position of the slider I can grab and drag with a mouse.

Naturally I want the volume to increase when the slider dragged up and decrease when the slider is dragged down.

How might I set it up just using events or even conditional events?
And then also, how might I simply script this?

I actually got the slider working so that it only can be dragged vertically and barriers at the top and bottom, so the slider can't be moved too far.
Samples of my art can be found at:

http://www.HodgePodgeStudios.com
User avatar
NyahKitty
 
Posts: 65
Joined: Fri Jul 29, 2005 1:28 am
Score: 0 Give a positive score

Postby NyahKitty » Tue Dec 20, 2005 7:35 pm

I'm currently trying:

-Actor: Volume Slider
-Event: Left mouse button down, no drag
-Script:
setVolume(0, y);


That doesn't seem to do anything, but I think I'm close.
Suggestions anyone?
Samples of my art can be found at:

http://www.HodgePodgeStudios.com
User avatar
NyahKitty
 
Posts: 65
Joined: Fri Jul 29, 2005 1:28 am
Score: 0 Give a positive score

Postby makslane » Tue Dec 20, 2005 9:45 pm

Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby NyahKitty » Tue Dec 20, 2005 10:19 pm

Yes, that's the thread I consulted for the slider.
It's just using it to change the volume of the game that is difficult.

Here's the URL to the file:

http://www.hodgepodgestudios.com/files/MISCELANEOUS/Dr_DeGroot.zip

Thanks!
Samples of my art can be found at:

http://www.HodgePodgeStudios.com
User avatar
NyahKitty
 
Posts: 65
Joined: Fri Jul 29, 2005 1:28 am
Score: 0 Give a positive score

Postby Game A Gogo » Tue Dec 20, 2005 10:34 pm

you know, there is a place in play music event on the script that represent the volume, create a var named volume, and on where there is the volume tingy, place volume, and on your slider, put the var as equal to the slider position.

not sure if this work, but i hope it dos.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Wed Dec 21, 2005 2:18 pm

To change the music volume just set the variable musicvol (http://www.game-editor.com/docs/script_ ... m#musicvol)

To get the value from your slide actor, you can calc based on current x position and initial x position:

musicvol = (x - xini)/slider_size;
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby NyahKitty » Wed Dec 21, 2005 7:00 pm

Is there a similar function for using the slider as a global volume setting for sounds?

The program sounds an alarm when the timer reaches zero.
So I'm using sound, rather than music.
Samples of my art can be found at:

http://www.HodgePodgeStudios.com
User avatar
NyahKitty
 
Posts: 65
Joined: Fri Jul 29, 2005 1:28 am
Score: 0 Give a positive score

Postby makslane » Fri Dec 23, 2005 9:13 pm

No, you need get the channel returned by the PlaySound function, put in some variable and use the setVolume to change.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby NyahKitty » Thu Dec 29, 2005 4:36 pm

Is there an example of this somewhere, so I can take a look at it?
Samples of my art can be found at:

http://www.HodgePodgeStudios.com
User avatar
NyahKitty
 
Posts: 65
Joined: Fri Jul 29, 2005 1:28 am
Score: 0 Give a positive score

Postby makslane » Mon Jan 02, 2006 12:35 pm

Look the sample:
http://game-editor.com/examples/slider.zip

The sliderPos actor set the pos variable between 0 and 1.
The sound actor use the pos valut to update the sound volume.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron