Move 10 steps - how many pixels is it?

Move 10 steps - how many pixels is it?
Does it depend on the resolution of the scene?

It's 10 units in the current direction that the sprite is facing. I use units here, because the stage can be resized, and pixels are usually a fixed size.

If you want to know the math behind it

Here's the math function snap uses to move steps.

$$x = x + (sin(direction) * steps)$$
$$y = y + (cos(direction) * steps)$$

Ok. Let's direction is precision vertically or horizontally.
1 step vertically, how many pixels is it?
1 step horizontally, how many pixels is it?

In terms of snap positioning, 1 step is 1 pixel (even though that's not the right word).

WHY ???

Well, how does the step size in pixels depend on the SIZE of the scene? I don't understand at all

1 Step in horizontal or vertical direction actually does correspond to what’s called a pixel in ‘Snap!. I guess what @ego-lay_atman-bay and @pajamaclaws21 mean is that a Snap! pixel is not a physical pixel; the ratio between these two kinds of pixels depends on stage size in Snap! pixels, the size of the Snap! stage on your screen, and the resolution of your screen.

Ok, well, costumes use pixels, but costumes can be resized, which means, there can be multiple sizes of pixels for different sprites. It's just best to call the snap position grid units rather than pixels to avoid correlation between positions and costumes.

And how do the size of the scene and Snap pixels compare?
After all, the ratio of the length and width of the scene can be determined by users

The answer is ten pixels, I suspect people are over thinking the math. I say this because I set the stage to five sizes and clicked the move ten steps block and noticed no obvious change in distance, therefore I suspect it's not related to stage size, in fact I vaguely recall a variant of this conversation before where someone suggested the code to implement retina was causing the numbers to appear different.

In Snap! 10steps it means moving 10 pixels and this remains consistent regardless of the scene's resolution if you want to know more about this then see doc.

I see what you mean. However "grid unit" is not an official Snap! term (it's neither used in block names, online help, nor the Reference Manual). The stage is supposed to be made up of "pixels". When the relevant sprite size is 100%, one pixel of the costume corresponds to one stage pixel; if the sprite size is different, its "pixels" are going to be displayed accordingly (e.g. size = 200% means 1 costume pixel = 2 stage pixels). Anyway, a move is always going to be over the stage, so it's stage pixels that matter.

Example:

  • Your display is 40 cm wide (approx. 16")
  • Your display has a horizontal resdolution of 1920 pixels
  • The width of your stage (in pixels) is 480 (this is the default setting; you may change this if you want, it's in the setings menu: select the gear wheel at the top of the screen)
  • You set your stage at 20 cm wide

Now the number of physical pixels over the width of your stage is (20 / 40) x 1920 = 960.
The ratio of physical pixels to stage pixels is 960 / 480 = 2. So every stage pixel is represented by 2 physical pixels (in horizontal direction). For vertical scale, make a similar calculation.

Quickly:

Default stage size is 480 x 360 (width x height) but tou can adapt these values to your project
untitled script pic (8)

Stage example

image

The stage is scalable with these controls:

image

The stage is scalable from .25 to 1 (1.3 in presentation mode)

scale = 0.5 example:

scale = 1 example:

Presentation mode:

So a real pixel isin't exist in snap, it's all relative to the stage size and the stage scale

1 step to the right represents (480 x 360 : scaled to .75) a move of
(1 / 480 * 0.75) but you don't need to care of this, snap does it for you...

Another thing: The sprites are scalable too ! (from 0 to what you want in percent) with this block:
untitled script pic (9)

Example: a 50 x 50 square at size 100%

image

Example: a 50 x 50 square at size 200%

image

I hope this will help you

a quick project about scaling the stage

1 step is 1 pixel, barring upscaling from 4K displays and the like. Scratch handles it the same way.

This was also already discussed here.

I'm not sure exactly what question the OP meant to ask, but what came to my mind is different from what all y'all are answering. My answer is: eleven pixels.

A pixel (a screen pixel, a scaled pixel, whatever) is a position (a dot, a point) on the stage. It's not a distance (a motion, a length, an extent). Even if your view of the stage is magnified so that you can see individual pixels, in principle the length of a pixel is zero.

A step (as in count change script pic) is the distance between two adjacent pixels. Although people use language loosely and talk about "a square of side length 100 pixels" (I do this myself!), what they mean is "100 steps."

Try this experiment:
untitled script pic (3)

How many pixels are lit up? (You may have to put your face right up against the stage to see it.)

How far did the sprite move? 0 steps.
How many pixels are lit up? 1 pixel.

Now try the same experiment, but with MOVE 1 STEPS. How far does the sprite move? How many pixels are lit up?

Both endpoints of the motion are lit up.

So if you move 10 steps (horizontally or vertically), you traverse 11 pixels.

10_is_10

Yes? As I said, distances are measured in steps, and if you move 10 steps, the distance to your starting point is 10 steps.

That's a different question from "how many pixels do you traverse?" If you're pointing in a random direction, that question is very hard to answer, because it depends on the algorithm your operating system and/or browser uses to draw lines (when does it decide to move to the next pixel vertically vs. horizontally) and also on the horrors of antialiasing.

But if you're moving horizontally or vertically by an integer amount from an integer position, the answer is easy: both endpoints are included, and so the number of pixels traversed is one more than the number of steps moved.