Discuss Scratch

Znitrutcher
Scratcher
62 posts

How to do Scrollx

I'm currently making a platformer, but I am having trouble comprehending the ScollX and ScrollY or how it works…
Could someone write me a code
and explain how it works?
Thanks.
deck26
Scratcher
1000+ posts

How to do Scrollx

Think of the Scratch screen as a window onto a ‘real world’. Things in the real world may have fixed coordinates or be moving in real world terms but at any one time all items have fixed real world coordinates. Whether they appear on screen or not and where they appear is then down to the position of the ‘window’. All scrollX does is keep track of where the window is - ie it is an adjustment which can be made to real world coordinates to get their screen position and if the resulting x value is between -240 and 240 the item will be on screen.

See my demo https://scratch.mit.edu/projects/92682141/
zelda_universe
Scratcher
100+ posts

How to do Scrollx

The background moves
set x to (scrollx) + (480) * (no. of background)
This script will be in all background (background 1will be 0)
In the sprite change the value of scrollx instead of x position. During sprite`s movement

Powered by DjangoBB