From Test-Scratch-Wiki

A sprite moving on the X axis.

The X Position is where the sprite is on the X axis (horizontal) of the stage. The value increases or decreases depending on how far right or left on the Stage the sprite is. Directly in the center is 0. The sprite's costume center is where the X and Y positions meet.

Related Blocks

The following blocks can be used in conjunction with this value:

— The stage monitor and reporter block that reports the value

— Sets the X Position to a value

— Changes the X Position by a value

— Goes to a spot on the stage, an X and Y value

— Goes to a sprite

— Glides over an amount of time to a certain spot

— A block that reports the value of any sprite's X Position, Y Position, Direction, Costume/Background number, Size, Volume, Variables

Example Uses

Some common uses for the X Position value are below:

  • Sliders
  • Moving horizontally
  • Finding a sprite's X Position

In Detail

Some more uses for x in detail:

  • X can be used in triggers, such as if a sprites x position equals something, it will broadcast an event to do something. This can be done with the x position variable.
  • X can also set variables, and cause something to change if it is linked to the variable. This can be done with the = < and > blocks.
  • X can be used to follow objects with the use of the x position of block, or go to an objects x plus or minus a certain amount, with the +,- or = blocks.
  • X is an alternative way to walking, mostly used in-staid of move () steps, when the sprite is turned a certain way.

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.