Discuss Scratch

Babissimo
Scratcher
100+ posts

Custom Volume Slider

I'm having touble on my game making a custom volume slider as I want to make it look how I want and not the basic scrath slider for my new OS unfortunately it is troublesome can anyone help?
ErnieParke
Scratcher
1000+ posts

Custom Volume Slider

For the slider itself, you can use this little piece of code:

whenclickedforeveriftouchingmouse pointer?thenifmousedown?thenrepeatuntilnotmousedown?ifmousex>50thensetxto50elseifmousex<0thensetxto0elsesetxtomousexsetVolumetoxposition/2waituntilnotmousedown

This is a script for a horizontal volume slider. If you want a vertical one, all you need to do is flip the x position and y positions. So (mouse x) would become (mouse y).

Helping,

ErnieParke

Last edited by ErnieParke (March 14, 2014 23:25:22)

scubajerry
Scratcher
1000+ posts

Custom Volume Slider

http://scratch.mit.edu/projects/19304733/#player

Last edited by scubajerry (March 15, 2014 07:30:04)

Babissimo
Scratcher
100+ posts

Custom Volume Slider

ErnieParke wrote:

For the slider itself, you can use this little piece of code:

whenclickedforeveriftouchingmouse pointer?thenifmousedown?thenrepeatuntilnotmousedown?ifmousex>50thensetxto50elseifmousex<0thensetxto0elsesetxtomousexsetVolumetoxposition/2waituntilnotmousedown

This is a script for a horizontal volume slider. If you want a vertical one, all you need to do is flip the x position and y positions. So (mouse x) would become (mouse y).

Helping,

ErnieParke
THX!
Varshinilolla
Scratcher
1 post

Custom Volume Slider

Hello,
I've been facing a problem to create custom volume slider since the one provided by scratch wasn't really helpful .There were a couple of answers given to this question but weren't really appealing .Therefore ,I wish another way to “code custom volume slider”.

Thanks

Last edited by Varshinilolla (Aug. 26, 2021 16:22:20)

orangetheory
Scratcher
500+ posts

Custom Volume Slider

scubajerry wrote:

http://scratch.mit.edu/projects/19304733/#player
Please don't spam or necropost

Varshinilolla wrote:

Hello,
I've been facing a problem to create custom volume slider since the one provided by scratch wasn't really helpful .There were a couple of answers given to this question but weren't really appealing .Therefore ,I wish another way to “code custom volume slider”.

Thanks
Please create your own topic
Rohancg
Scratcher
72 posts

Custom Volume Slider

If you want, you can use the 100% pen slider I made. https://scratch.mit.edu/projects/549425162/

Powered by DjangoBB