X Position (value)
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.
The following blocks can be used in conjunction with this value:
- X Position — The stage monitor and reporter block that reports the value
- Set X to () — Sets the X Position to a value
- Change X by () — Changes the X Position by a value
- Go to X: () Y: () — Goes to a spot on the stage, an X and Y value
- Go to () — Goes to a sprite
- Glide () Secs to X: () Y: () — Glides over an amount of time to a certain spot
- () of () (Sensing block) — A block that reports the value of any sprite's X Position, Y Position, Direction, Costume/Background number, Size, Volume, Variables
Some common uses for the X Position value are below:
- Moving horizontally
- Finding a sprite's X Position
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.