Topic Information

Scrolling ScrollX variable jumping from -700 to 7000 by pufferfish101007 in Help With Scripts

Posts: 5

1: pufferfish101007 wrote at 2:54:48 PM 14/5/20204011488
Here's my problem:
I am making a scrolling project, which I can normally do, and I have a ball which rolls along by itself. But, when the ScrollX variable reaches about -700 (when the second costume in the level 1 sprite is on-screen), the variable jumps to about 7000, and so doesn't work, because it should keep going down. Here is the project: https://scratch.mit.edu/projects/391658322/ , and I'm fairly sure that the problem is in the level 1 sprite, or it might be in the ball sprite (I can't remember it's name). Thanks in advance, I appreciate any help, because I am really confused.
2: Oumuamua wrote at 3:09:56 PM 14/5/20204011505
Are you multiplying by -10?
3: memanuelhe wrote at 3:17:09 PM 14/5/20204011517
So the project's problem is this script right here:

define move horizontal
if <touching color [#000000] ?> then
if <[x velocity] > [0]> then
repeat until <not <touching color [#000000] ?>>
change [x velocity] by (-1)
end
else
repeat until <not <touching color [#000000] ?>>
change [x velocity] by (1)
end
end
set [x velocity] to [0]
end

When you do it with a screen refresh it works fine, well it goes in the level the way back but it's better than going up to 70000. What i recommend you do is check if any without screen refresh makes the problem happen sometimes it does. Well, now you know what to work on, have a nice day
4: pufferfish101007 wrote at 4:18:33 PM 14/5/20204011615

memanuelhe wrote:

~snip~
When you do it with a screen refresh it works fine, well it goes in the level the way back but it's better than going up to 70000. What i recommend you do is check if any without screen refresh makes the problem happen sometimes it does. Well, now you know what to work on, have a nice day
Thankyou! I'll try it.
5: pufferfish101007 wrote at 4:38:12 PM 14/5/20204011655
Ok, so now the ScrolX variable isn't jumping, but the third scrolling costume still isn't showing. Any ideas?