Volume Control

This forum is currently in read-only mode.
From the Asset Store
10 different explosions rendered as transparent PNG.
  • Hi. I need a volume control which is controlled by the mouse. When a player clicks on any part of the circle, then moving the mouse he increases or decreases the volume. How to make a circle to rotate when you click on any part of it?

  • mouse is over object

    mouse button left is down

    ->object set angle towards position mousex, mousey

    xaudio2 set volume to clamp(object angle, min volume, max volume)

    ... with object angle preset to 0

    Might want to put a lerp in there to use more of the circumference.

  • Thanks. I made as you said, but the circle jerks when I try to spin it anywhere. It must begin rotate from the point where it has stopped. And I don't know how to use lerp, can you help me, please?

  • I've tried multiple variants, but can't make it. Here is what I have got. example v.3 Does anyone have any ideas?

  • This is probably a better way to do it using the actual values, and just clockwise/ counter clockwise.


    Keep in mind you can have negative values on the volume.

  • Thank you Newt, but your version is not suitable for me, because I need control rotates only when we move the mouse. I've almost made this, you can watch on video or download a cap file below. The only thing I couldn't get is to remove jerks which unaccountably appear sometimes when rotating the volume control and spoil the view.


    cap file: http://dl.dropbox.com/u/10760635/example_v.4.cap

    Why does the volume control often jerk and abruptly change the angle? How to fix this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah, that's the reason I went for the other way.

    There's no such thing as an angle above 360, likewise none below 0, so it resets.

    All you can do is compare the sprites angle to make sure it doesn't go above or below.

  • All you can do is compare the sprites angle to make sure it doesn't go above or below.

    I compare the sprites angle, look at the this screenshot:

    <img src="http://d.imagehost.org/0528/images_1.png">

    Maybe I'm doing something wrong. If so, tell me please how to make the correct event that would compare the angles and the circle would move without jerks?

    Is there any plugin?

    Or this program cannot to make a simple volume control controlled by the mouse?

    <img src="http://d.imagehost.org/0802/bad_stan.png">

  • The problem becomes much simpler if you use only the change in MouseX to rotate the dial:

    http://dl.dropbox.com/u/5426011/examples3/dial2.cap made in 0.99.96

    Here's an example of a dial the way you've been doing it with the angle to the mouse. The range of motion is from 135 degrees clockwise to 45 degrees, which is about the range of motion that real volume dials have.

    http://dl.dropbox.com/u/5426011/examples3/Dial3.cap made in 0.99.96


  • I've downloaded both caps, it looks very seriously, but most importantly - it works! I will necessarily try to understand this. Thank you guys!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)