2. Motion

Motion code blocks are responsible for making your sprites move.

2.1. Basic moving

_images/00-move_10_steps.png

This code block moves a sprite left and right.

Code

2.2. Basic Rotation

_images/01-turn-right-15-degrees.png

This code block rotates a sprite to the right by 15 degrees.

_images/02-turn-left-15-degrees.png

This code block rotates a sprite to the left by 15 degrees.

Code

2.3. Moving to a random position

_images/03-go-to-random-position.png

This code block moves a sprite to a random x-y position.

Code

2.4. Moving to the mouse pointer

_images/04-go-to-mouse-pointer.png

This code block moves a sprite to wherever the mouse cursor is on the stage.

Code

2.5. Moving to a specific x and y coordinate

_images/05-go-to-x-y.png

This code block moves a sprite to a specific x-y location.

Code

2.6. Gliding

Gliding is different from moving. When you move a sprite, it disappears and then reappears where you want it to be. When you glide a sprite, a smooth transition is created from where the sprite currently is located to where you want it to be; there is animation involved.

_images/06-glide-to-random-position.png

This code block glides a sprite to a random position.

_images/07-glide-to-mouse-pointer.png

This code block glides a sprite to wherever the mouse cursor is on the stage.

_images/08-glide-1-sec-to-x-y.png

This code block glides a sprite to a specific x-y location.

Code

2.7. Pointing

_images/09-point-in-direction-90.png

This code block points a sprite to specified direction (in angles).

_images/10-point-towards-mouse-pointer.png

This code block points a sprite towards the mouse cursor.

Code

2.8. Changing x

_images/11-change-x-by-10.png

This code block adds the specified value to the current x position value.

_images/12-set-x-to-0.png

This code block sets the x position value to a specific value.

Code

2.9. Changing y

_images/13-change-y-by-10.png

This code block adds the specified value to the current y position value.

_images/14-set-y-to-0.png

This code block sets the y position to a specific value.

Code

2.10. Bouncing

_images/15-if-on-edge-bounce.png

This code block bounces a sprite if it is on the edge of the stage.

Code

2.11. Rotation styles

_images/16-set-rotation-style-left-right.png

This code block sets the rotation style to left-right.

_images/17-set-rotation-style-all-around.png

This code block sets the rotation style to all around.

_images/18-set-rotation-style-dont-rotate.png

This code block sets the rotation style to don't rotate.

Code