Sprites moves a specified number of pixels towards a location.
Rather than specify an exact direction to move in, this block lets the sprite move towards a location. This can be useful when you want a sprite to target something or chase another sprite.
No matter where the target is, the pick will always get a bullseye. Press the ‘t’ key to throw the pick.
The dog loves chasing the bone! Click and hold on the bone to drag it around the display, and press the spacebar to have the dog chase it.
This project has the same function as the one above but uses the “chasing” behavior to allow the dog to chase the bone.
Name | Description |
---|---|
sprite | The sprite or sprite group to move |
number | The number of pixels the sprite is moving |
location | The location that the sprite is moving toward |
Found a bug in the documentation? Let us know at documentation@code.org