- Not to be confused with Change X by () or Change Y by ().
Move () Steps | |
move () steps | |
Category | Motion |
Type | Stack |
Introduced in | 11Oct03 (0.x) |
The Move () Steps block is a stack block and a Motion block. The block moves its associated sprite forward by the specified amount of "steps" in the direction the sprite is facing, where a step is one pixel in length. If a negative number of steps is specified, the sprite will move in the direction opposite to its direction instead.
Like all other Motion blocks, this block is not directly accessible from the stage. If the block is imported from another sprite, the block does not move the stage when run.
Prior to Scratch 25Nov04, this block was known as "forward ()".
Example Uses
Instead of using complicated scripts with the Change X by () block and the Change Y by () block, this block can be easily used to move a sprite in its direction.
Some common uses for the block are:
- Making sprites move:
when gf clicked set rotation style [left-right v] forever move (10) steps if on edge, bounce
- Moving a sprite forward in an animation:
repeat (10) move (10) steps end
- Making a sprite follow the mouse:
forever point towards (mouse-pointer v) move (10) steps end
- Making a sprite follow another sprite:
forever point towards (other sprite v) move (10) steps end
Workaround
- Main article: List of Block Workarounds
This block can be replicated with the following code:
go to x: ((x position) + (([sin v] of (direction)) * (number))) y: ((y position) + (([cos v] of (direction)) * (number))
or:
change x by ((steps) * ([sin v] of (direction))) change y by ((steps) * ([cos v] of (direction)))