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

#1 2009-02-13 00:34:18

mark2810
Scratcher
Registered: 2009-02-01
Posts: 2

Scrolling Backgrounds

Hi all,

Trying to do a seamless horizontal scroll with two sprites using the 'leap frog' technique. Both sprites are 480 x 360 so they take up the whole stage.

Each sprites x-value decreases constantly, until it reaches -480, then leaps back to a position of 480 on the x-axis. Only the sprite won't make it -480, it only moves to the left as far as -462.

Just wondering if anyone knows why this is?

Thanks for reading,

Mark.

Offline

 

#2 2009-02-13 00:39:48

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Scrolling Backgrounds

No clue Mark, it would be much easier to understand the problem if you posted the project. That way I can download it and look at it.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2009-02-13 00:59:40

mark2810
Scratcher
Registered: 2009-02-01
Posts: 2

Re: Scrolling Backgrounds

Thanks for the tip. Project is now online:

http://scratch.mit.edu/projects/mark2810/414506

The code is on the 'stars1' and 'stars2' sprites. Where the values are set to '-462' and '462', try set them to '-480' and '480' and it should stop scrolling.

Offline

 

#4 2009-02-13 10:26:31

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Scrolling Backgrounds

Oh I know what is wrong. When played in the scratch program sprites can only go so far off screen. In the online player, sprites can go farther offscreen.

You can't really do anything about how far it goes offscreen.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2009-02-13 11:13:35

mrweston
Scratcher
Registered: 2007-12-13
Posts: 100+

Re: Scrolling Backgrounds

Yeah, it took me ages to figure that out -- kept thinking I was somehow missing something in the code, and ended up abandoning my scrolling projects.

Anyone know why this happens in the editor, and if it's on the list of to-be-fixed?

Offline

 

#6 2009-02-13 14:35:17

Ssbrawl700
Scratcher
Registered: 2009-02-11
Posts: 100+

Re: Scrolling Backgrounds

there is the sample project called snn and the little news thing at the bottom uses something like that


Can you beat the ever-so challenging Keyboard Khaos?

Offline

 

Board footer