Allow sprite positions that are not whole numbers

id: 751024

category: Suggestions

posts: 6

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 LionCoder10 loading
yay you're active

Support, the choppy movement gets really annoying to see, especially when I see it chop up one pixel lol
LP372 LP372 loading
Support, smoother movement would be easier.
SpyCoderX SpyCoderX loading
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 -stxllxr loading
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.