Discuss Scratch

deck26
Scratcher
1000+ posts

help with maze game

FateSealer wrote:

Thanks @deck26 for your shared project:
https://scratch.mit.edu/projects/51479882/

But, I believe, your project suffers from the “near-the-edge” scrolling defect (both horizontally and vertically). I mean, if any of your clones goes near to the edge of the stage via scrolling (say, closer than 16px), than it will not be shown properly. More explicitly, your adjacent clones will overlap.

That is why several scrolling projects have a border around the stage, which might be a more or less acceptable workaround for this problem. (I am not trying to suggest this workaround.)
It was just a demo I did 5 years ago! There are known solutions to that problem now which could be applied to it.
FateSealer
Scratcher
100+ posts

help with maze game

To my knowledge, the only solution that enables fine scrolling (1px), without considering the Z-order of sprites, is the following:

1. Use your favorite image editor to create a big image (it is the image of your world; say, 5000x5000 px)

2. Split this big background picture so, that resulting small images slightly overlap each other horizontally and vertically. (The size of the overlap should be 16px.)

3. Import these small images to Scratch (they can be different sprites or simply clones of the same sprite). These small images will act as your background images during the scrolling.

4. When scrolling, you should position your adjacent sprites so, that they overlap each other. So, of course, the user shouldn't see the overlapping 16px twice.

Please, let me know, if there is any better / easier solution.

deck26
Scratcher
1000+ posts

help with maze game

Scratch will now allow a costume to go off stage if you select a larger costume for the move and then switch to the costume that would otherwise be off-screen. So there is no real need for overlapping sprite costumes although that is another solution.
EpicGhoul993
Scratcher
1000+ posts

help with maze game

logais wrote:

Ok, can’t you just give me the scripts for it though?
Eh, I'm on mobile.
deck26
Scratcher
1000+ posts

help with maze game

https://scratch.mit.edu/projects/419039062/ shows that using size allows you to get a sprite off-screen. That should allow you to manage the edge clones.
FateSealer
Scratcher
100+ posts

help with maze game

It works, very cool. Thank you.

Powered by DjangoBB