Discuss Scratch

goldfish678
Scratcher
1000+ posts

How to make a slider.

(GUIDE)

So, a lot of people have wanted to make a slider. Well I know how to make a simple one! NOTE: If you want yours to be really advanced, please use this as a base and modify it.

First, make your slider sprite.

Then, make a variable called “clicked?”.

Then, put these scripts in:

set clicked? to (0)
go to x: (-168) y: (desired y position)
show
forever
if <<touching mouse-pointer?> and <mouse down?>> then
set clicked? to (1)
set x to (mouse x)
if <(x position) > 168> then
set x to 168
end if loop
if <(x position) < -168> then
set x to -168
end if loop
end if loop
if <not<mouse down?>>
if clicked=1
if <(x position) = 168> then
hide
stop this script
else
glide (0.3) secs to x: -168 y: -138
end if loop
end if loop
set clicked to (0)
end if loop
end forever loop

Not reccomended trying to read this if you are a beginner to Scratch. If you are, ask questions about text-based scripts, and then come back. It will be a lot easier.

Reference: http://scratch.mit.edu/projects/11686519/

Last edited by goldfish678 (Aug. 2, 2013 18:55:15)

coolitsusa
New Scratcher
100+ posts

How to make a slider.

You should put [GUIDE] in the title, because people might come here to tell you how to make a slider, not to learn how.

Last edited by coolitsusa (Aug. 2, 2013 17:55:51)

Gaza101
Scratcher
500+ posts

How to make a slider.

This project demonstrates a less glitchy version.
goldfish678
Scratcher
1000+ posts

How to make a slider.

No, I meant a slider, the slide-to-unlock kind.
MCjason2
Scratcher
41 posts

How to make a slider.

goldfish678 wrote:

(GUIDE)

So, a lot of people have wanted to make a slider. Well I know how to make a simple one! NOTE: If you want yours to be really advanced, please use this as a base and modify it.

First, make your slider sprite.

Then, make a variable called “clicked?”.

Then, put these scripts in:

set clicked? to (0)
go to x: (-168) y: (desired y position)
show
forever
if <<touching mouse-pointer?> and <mouse down?>> then
set clicked? to (1)
set x to (mouse x)
if <(x position) > 168> then
set x to 168
end if loop
if <(x position) < -168> then
set x to -168
end if loop
end if loop
if <not<mouse down?>>
if clicked=1
if <(x position) = 168> then
hide
stop this script
else
glide (0.3) secs to x: -168 y: -138
end if loop
end if loop
set clicked to (0)
end if loop
end forever loop

Not reccomended trying to read this if you are a beginner to Scratch. If you are, ask questions about text-based scripts, and then come back. It will be a lot easier.

Reference: http://scratch.mit.edu/projects/11686519/
Can't You Just Use The New Scratchblocks?
when I receive [scratchblocks]
say [ScratchBlocks Are Cool!] for (2) secs
Write: Scratchblocks
[scratchblocks]

Last edited by MCjason2 (Nov. 16, 2014 01:22:33)

hotsaucehater
Scratcher
62 posts

How to make a slider.

Put it in scratchblocks to make it easier for the less-advanced scratchers to read
datamonkey12345
Scratcher
22 posts

How to make a slider.

Put it in scratch blocks so it's easier for less-advanced scratchers to read. - Datamonkey12345
Wong2016
Scratcher
24 posts

How to make a slider.

goldfish678 wrote:

(GUIDE)

So, a lot of people have wanted to make a slider. Well I know how to make a simple one! NOTE: If you want yours to be really advanced, please use this as a base and modify it.

First, make your slider sprite.

Then, make a variable called “clicked?”.

Then, put these scripts in:

set clicked? to (0)
go to x: (-168) y: (desired y position)
show
forever
if <<touching mouse-pointer?> and <mouse down?>> then
set clicked? to (1)
set x to (mouse x)
if <(x position) > 168> then
set x to 168
end if loop
if <(x position) < -168> then
set x to -168
end if loop
end if loop
if <not<mouse down?>>
if clicked=1
if <(x position) = 168> then
hide
stop this script
else
glide (0.3) secs to x: -168 y: -138
end if loop
end if loop
set clicked to (0)
end if loop
end forever loop

Not reccomended trying to read this if you are a beginner to Scratch. If you are, ask questions about text-based scripts, and then come back. It will be a lot easier.

Reference: http://scratch.mit.edu/projects/11686519/
Maybe this:
when green flag clicked//or other hat block.
set [clicked? v] to [0]
go to x: (-168) y: [(desired y position)]
show
forever
if <<touching [mouse-pointer v]?> and <mouse down?>> then
set [clicked? v] to [1]
set x to (mouse x)
if <(x position) > [168]> then
set x to (168)
end
if <(x position) < [-168]> then
set x to (-168)
end
if <not<mouse down?>>
if <(clicked?) = [1]
if <(x position) = (168)> then
hide
stop [this script v]
else
glide (0.3) secs to x: (-168) y: (-138)
end
end
set [clicked? v] to [0]
end
end
-Coranda-
Scratcher
1 post

How to make a slider.

What do you mean by
go to x: (-168) y: (Desired y position)

Last edited by -Coranda- (Dec. 5, 2016 03:55:13)

card100
Scratcher
1000+ posts

How to make a slider.

Nice guide! I might try it with pen!

Powered by DjangoBB