Discuss Scratch

ilikelegos
Scratcher
100+ posts

stamp scrolling

I would like to make a scrolling game. I already know the normal scrolling scripts but I would like to use a method of drawing the areas by stamping. here's a link to a project that uses that method of drawing: http://scratch.mit.edu/projects/18597104/
If you know how to combine this with scrolling I would much appreciate if you told me.
drmcw
Scratcher
1000+ posts

stamp scrolling

Depends how you store the world. You then need a scrollx variable as in normal scrolling but this time it would be an offset into the data that stores your world. A better method could be to use clones that tile the screen and can move then as they drop off the end you can move them to the other, rather than stamping you just change costume.
DadOfMrLog
Scratcher
1000+ posts

stamp scrolling

Yes, tiling the plane with clones, and moving those around to scroll, is the more efficient way to do it - as pioneered by griffpatch's Paper Minecraft.

Now, you *can* also do it by stamping, but the important thing, whichever you do, is to ensure you don't switch costume all the time (because that's an expensive operation for Scratch to calculate, so you don't want to do it every frame for every one of your tiles). This means, even if you do choose to stamp, you're still better off doing it with clones - because each one can keep the same costume most of the time.

Here's a decent demo project: http://scratch.mit.edu/projects/12706249/ (note the part in there which checks whether the costume number has changed before it actually does the switch)

The above demo could be made a touch more efficient by having each clone track all the way across the screen until it ‘falls off’ an edge (and so picks up a new tile at the opposite edge). That way it would only have to switch costume when it has to pick up a new tile from an opposite edge (assuming that the tile stays the same the whole time it's on-screen), rather than it switching when the adjacent cell moves far enough into its position.

Hope that's useful!

Last edited by DadOfMrLog (March 6, 2014 18:53:37)

Powered by DjangoBB