Category:Actions

Moves a sprite or group of sprites the given number of pixels in the selected direction.

This block lets sprites move around the display. A sprite can move in four directions, and a default number block is given to specify how many pixels the sprite will move at a time.

Examples

Example 1

The most common use of this block outside of behaviors is to make a sprite move with the arrow keys.

Parameters

NameDescription
sprite The sprite or sprite group moving
number Number of pixels the sprite moves
direction The direction the sprite moves in: north, east, south, west

Tips

  • The block makes the sprite move the given number of pixels only once. To make the sprite continuously move in a direction, set the block to “while key pressed” instead “when key pressed” so that the sprite will move the number of pixels over and over again while the key is pressed.
  • Any math block can be used in place of the number block.

Found a bug in the documentation? Let us know at documentation@code.org