This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-06-15 01:32:32

mabbs123
Scratcher
Registered: 2010-04-20
Posts: 18

Stop Scrolling

How would you stop scrolling at a certain background sprite, so that my main sprite cant move past that frame?


...........I'm A Bubble.............

Offline

 

#2 2010-06-15 01:54:15

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Stop Scrolling

In the script that changes the Scroll X/Y, it probably looks like the following, right?

[if <key [left arrow] pressed?>]
[][change [Scroll X] by (5)]
[end if]

Change it to this:

[if <key [left arrow] pressed?>]
[][if <((Scroll X)) = (Scroll X value of object)>]
[][][change [Scroll X] by (5)]
[][end if]
[end if]

Instead of just changing the Scroll X variable when the key is pressed, it checks if Scroll X has reached the object's Scroll X value. If it has, the Scroll X variable won't change - if it hasn't reached it yet, Scroll X will change. Any questions?


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#3 2010-06-15 04:05:02

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: Stop Scrolling

What Jonathanpb posted will work, but unless it stops at exactly that point it'll keep going. Try this:

if <(Scroll X) > [Scroll X value of object]>
set Scroll X to [Same number as above]
end

What this basically does is it prevents the Scroll X variable from going past where you want it to stop. Use it along with Jonathanpb's script so you don't get "screen flickering".

Last edited by hmnwilson (2010-06-15 04:06:35)


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#4 2010-06-20 01:35:49

deepac
New Scratcher
Registered: 2010-06-20
Posts: 3

Re: Stop Scrolling

So if I wanted it to continuously scrolling this will do, correct?
[if <key [left arrow] pressed?>]
[][if <((Scroll X)) = (Scroll X value of object)>]
[][][change [Scroll X] by (5)]
[][end if]
[end if]

Offline

 

#5 2010-06-20 02:22:05

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Stop Scrolling

deepac wrote:

So if I wanted it to continuously scrolling this will do, correct?
[if <key [left arrow] pressed?>]
[][if <((Scroll X)) = (Scroll X value of object)>]
[][][change [Scroll X] by (5)]
[][end if]
[end if]

If you want it to always scroll and never stop, just do this:

[forever]
[][change [Scroll X] by (number)]
[end forever]


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

Board footer