Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » x and y scroller
- _Floof_
-
9 posts
x and y scroller
How do you make a scroller that scrolls both sideways and upwards?
Extra question:
Can you make it only scroll upwards when you reach a specific height?
Sincerely _Floof_
Extra question:
Can you make it only scroll upwards when you reach a specific height?
Sincerely _Floof_
- deck26
-
1000+ posts
x and y scroller
The technique is the same, you just need scrollX and scrollY variables and each non-player sprite needs to know its real world position (scrollX/Y are just adjustments to the real world coordinates to decide if the item is visible in the current window).
Only scrolling when y is above a certain value is relatively trivial - either adjust y or scrollY according to the situation.
Only scrolling when y is above a certain value is relatively trivial - either adjust y or scrollY according to the situation.
- _Floof_
-
9 posts
x and y scroller
Thank you very much The technique is the same, you just need scrollX and scrollY variables and each non-player sprite needs to know its real world position (scrollX/Y are just adjustments to the real world coordinates to decide if the item is visible in the current window).
Only scrolling when y is above a certain value is relatively trivial - either adjust y or scrollY according to the situation.
I tested it and the sprites end up on the edge of the screen if the player moves around in the “starting” sprite, do I have to make a border or something like that?
A solution would be greatly appreciated.
Link:
https://scratch.mit.edu/projects/199035693/
(don't mind the pictures)
- deck26
-
1000+ posts
x and y scroller
Scratch doesn't like sprites going completely off screen so a border can help hide sprites. Otherwise you have to hide them yourself when their ‘world’ coordinate mean they're outside (or close enough) the visible area.Thank you very much The technique is the same, you just need scrollX and scrollY variables and each non-player sprite needs to know its real world position (scrollX/Y are just adjustments to the real world coordinates to decide if the item is visible in the current window).
Only scrolling when y is above a certain value is relatively trivial - either adjust y or scrollY according to the situation.
I tested it and the sprites end up on the edge of the screen if the player moves around in the “starting” sprite, do I have to make a border or something like that?
A solution would be greatly appreciated.
Link:
https://scratch.mit.edu/projects/199035693/
(don't mind the pictures)
- DerpyHead0
-
1000+ posts
x and y scroller
Actually, there's a trick to make a sprite go off the edge.
For the huge box costume, make it in vector mode, and drag the edges of the box past the edges of the canvas. it doesn't need to be ridiculous, it just needs to not be too close to the edges
For the huge box costume, make it in vector mode, and drag the edges of the box past the edges of the canvas. it doesn't need to be ridiculous, it just needs to not be too close to the edges
- Discussion Forums
- » Help with Scripts
-
» x and y scroller