Discuss Scratch

FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

I’m trying to make a scrolling engine, but it has a LOT of bugs. If someone could look at the project and give me some insights, it would be much appreciated :D


when green flag clicked
say [I hate bugs…]
FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

plum_the_fox
Scratcher
1000+ posts

I need help with a scrolling engine.

griffpatch has a pretty good scrolling engine or you have the one by shiftclicklearn
FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

plum_the_fox wrote:

griffpatch has a pretty good scrolling engine or you have the one by shiftclicklearn
Well, it’s not supposed to be a tile scrolling engine, just a plain fixed level that you can complete. The project has a list of specific bugs I could use help with. But thank you for the tip
NMario84
Scratcher
1000+ posts

I need help with a scrolling engine.

Well…. The general idea for scrolling is that when your player moves forward, you want to move the background in the opposite direction your player is moving. So you want to make some variables that define camera movement. So for example, if the player moves from the left side reaching at the center of the screen, from here you then want to keep moving everything backwards to give the effect of scrolling..Since you can't move backdrops in Scratch, you want to make all of your level assets as sprites.

Here are some example from the scratch wiki:
https://en.scratch-wiki.info/wiki/Scrolling_(sprites)
https://en.scratch-wiki.info/wiki/Scrolling_Platformer_Tutorial

Long story short, if you are holding right to make the player move forward, you want to move stage assets left.
FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

Thanks for trying to help, but I’ve already done the basic code for the project (see page one on this topic for the link) I just need help with a few bugs that are getting in the way of things
kansea
Scratcher
500+ posts

I need help with a scrolling engine.

This is a fairly basic platformer that includes scrolling. You might want to take a look at how I'm handling the scrolling, movement, and jumping, and how collisions are being detected and fixed: https://scratch.mit.edu/projects/1260160888/
plum_the_fox
Scratcher
1000+ posts

I need help with a scrolling engine.

FLAMINFOX711 wrote:

plum_the_fox wrote:

griffpatch has a pretty good scrolling engine or you have the one by shiftclicklearn
Well, it’s not supposed to be a tile scrolling engine, just a plain fixed level that you can complete. The project has a list of specific bugs I could use help with. But thank you for the tip
shift click learn's isn't tile based (if i remember)
FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

I might check it out. The only thing is I’m trying to develop my own, if you know what I mean. To A. Develop my coding skills and B. Give myself a challenge
plum_the_fox
Scratcher
1000+ posts

I need help with a scrolling engine.

FLAMINFOX711 wrote:

I might check it out. The only thing is I’m trying to develop my own, if you know what I mean. To A. Develop my coding skills and B. Give myself a challenge
i know i didn't know if you could have used it as a base
DanDanbingobam
Scratcher
38 posts

I need help with a scrolling engine.

Scrolling engines are notoriously tricky! Most bugs usually come down to Screen Refresh lag or Edge Limits (where Scratch stops sprites from moving off-stage).

To get the best help, could you share the link to your project? In the meantime, here are a few things you can check that usually fix ‘scrolling’ bugs:

1. Is ‘Run without screen refresh’ on?
If your scrolling logic is inside a custom block, make sure this box is checked. It stops the ‘jittery’ movement.

2. The ‘Hide at Edges’ Trick:
Scratch sprites get stuck at the edge of the screen (around X=240). If your clones aren't disappearing correctly, try this:
when I receive [Update Position v]
set x to ((My X) - (Scroll X))
set y to ((My Y) - (Scroll Y))
if <([abs v] of (x position)) > [230]> then
hide
else
show
end

3. Movement Order:
Make sure your Scroll X/Y variables are updated before the sprites try to move to them. If they happen in the wrong order, the map will look like it's vibrating.

Post the link when you can, and I'd be happy to take a look at your scripts!
FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

braxlord
Scratcher
47 posts

I need help with a scrolling engine.

Easier Method:

when green flag clicked
set [cam x v] to (0)
set [cam y v] to (0)
forever
move to () ()
end
define move to (x) (y)
go to x: ((x)-(cam x)) y: ((y)-(cam y))
if <not<<([abs v] of ((x)-(cam x)))>(235)>or<([abs v] of ((y)-(cam y)))>(175)>>> then
show
else
hide
end
or if you want to use pen:

when green flag clicked
set [cam x v] to (0)
set [cam y v] to (0)
forever
move to () ()
end
define move to (x) (y)
if <not<<([abs v] of ((x)-(cam x)))>(235)>or<([abs v] of ((y)-(cam y)))>(175)>>> then
go to x: ((x)-(cam x)) y: ((y)-(cam y))
stamp
else
// this can be blank
end

Last edited by braxlord (Feb. 17, 2026 13:09:41)

FLAMINFOX711
Scratcher
89 posts

I need help with a scrolling engine.

I no longer need help with it. Thanks to the people who helped

Powered by DjangoBB