Discuss Scratch

alexandretherrien
Scratcher
500+ posts

Allow sprite positions that are not whole numbers

If you set at sprite position to x = 10, as expected the sprite will move to x = 10. If you then set the position to 10.4, you would expect the sprite to move a little bit to the right.

In reality, the sprite's ‘'x position’' variable will change to 10.4, but the sprite will not move at all on the screen. That is because, on the stage, sprites can only go to positions that are whole numbers. The problem with this is that it makes every movement more choppy and less precise.

Turbowarp's ‘'high quality pen’' setting fixes the problem by allowing positions that are not whole numbers. So, to show how this issue affects projects, here's the same scratch project, but the first link is how the project looks on scratch the second one is how the scratch project would look if decimal positions were allowed (high quality pen enabled).

1. https://scratch.mit.edu/projects/891057830/fullscreen/

2. https://turbowarp.org/891057830/fullscreen?hqpen

Noticed how, with the second link, the movement of the background is way smoother than with the first link where the background movement is not smooth at all. Unfortunately, right now, this problem can not be fixed on scratch and will be noticed even in the most well made projects.


So could the Scratch Team allow sprite positions that are not whole numbers?
LionCoder10
Scratcher
1000+ posts

Allow sprite positions that are not whole numbers

yay you're active

Support, the choppy movement gets really annoying to see, especially when I see it chop up one pixel lol
LP372
Scratcher
1000+ posts

Allow sprite positions that are not whole numbers

Support, smoother movement would be easier.
SpyCoderX
Scratcher
1000+ posts

Allow sprite positions that are not whole numbers

Support. This would allow for smoother and more precise animated… anything.

This might be able to have a block that allows you to toggle having decimals in the position value.
set position style [decimals v] ::motion

set position style [no decimals v] ::motion

(position style ::motion)
-stxllxr
New Scratcher
100+ posts

Allow sprite positions that are not whole numbers

I see no reason not to add this, it's a minimal change with massive uses that can't really confuse new Scratchers, as they would have to enable it and the x position could stay shown rounded in the sprite editor area where you can manually set position, direction, etc.

This allows for more advanced use of the screen, as many have said I often see the changing one pixel at a time, which isn't very smooth but with this it can be smooth.

Furthermore, Scratch already allows decimal x and y values, the displayed position is just rounded but if you use this script:
repeat (4)
change x by (0.3)
the sprite will move 1 pixel to the right.

In addition, like the OP stated this allots for more precise pen movement, and pen is a substantial corner piece of many projects, which this would improve.

Lastly, this won't cause problems in projects, because if it was like how post #4 stated, it would be an style or option on integer only values, which would not affect any past projects as other updates have.
alexandretherrien
Scratcher
500+ posts

Allow sprite positions that are not whole numbers

bump
pkhead
Scratcher
1000+ posts

Allow sprite positions that are not whole numbers

huh, i just came across this limitation today. took me 10 years on scratch to learn that positions only display at integer coordinates. i tried making a cursor bob slightly up and down only to learn that, uh, this is a thing. it bobs with an amplitude of only two pixels because anything larger is too much, and the choppiness is very apparent.

i agree with the previous replies; i think a block to toggle this feature on/off would be nice… maybe call it like, “enable/disable position rounding” or something.
The-Sushi-Cat
Scratcher
1000+ posts

Allow sprite positions that are not whole numbers

pkhead wrote:

huh, i just came across this limitation today. took me 10 years on scratch to learn that positions only display at integer coordinates. i tried making a cursor bob slightly up and down only to learn that, uh, this is a thing. it bobs with an amplitude of only two pixels because anything larger is too much, and the choppiness is very apparent.

i agree with the previous replies; i think a block to toggle this feature on/off would be nice… maybe call it like, “enable/disable position rounding” or something.
I dunno. I don't see an issue if it's just permanent. Is there a chance it may break older projects that relied on the sprite position to not move if it wasn't a whole number?

Last edited by The-Sushi-Cat (Sept. 2, 2025 12:11:33)

pkhead
Scratcher
1000+ posts

Allow sprite positions that are not whole numbers

The-Sushi-Cat wrote:

pkhead wrote:

huh, i just came across this limitation today. took me 10 years on scratch to learn that positions only display at integer coordinates. i tried making a cursor bob slightly up and down only to learn that, uh, this is a thing. it bobs with an amplitude of only two pixels because anything larger is too much, and the choppiness is very apparent.

i agree with the previous replies; i think a block to toggle this feature on/off would be nice… maybe call it like, “enable/disable position rounding” or something.
I dunno. I don't see an issue if it's just permanent. Is there a chance it may break older projects that relied on the sprite position to not move if it wasn't a whole number?
the x and y position blocks report its precise position, so code would act the same. its just the rendering engine that ignores the subpixel component.

but I should add i think i understand why it's like this in the first place. scratch 1.0 had only bitmap graphics, and subpixel positioning stuff with pixely graphics doesn't look that good in general. also the screen probably had the same resolution as the bitmap graphics as well. its probably like this to maintain backwards compatibility. but vector graphics have been in scratch since 2.0, released in 2013, so the fact that you can't disable this limitation in 2025 is a bit annoying.

Powered by DjangoBB