Using Coordinate and Glide block
Location of any sprite placed in stage area is determined by x-y coordinates. Sprite can be moved or glided from one set of coordinate to another.
Finding the location of sprite
You can find the current location of your sprite by checking the “Current Sprite Info” area shown below:
- X: gives the position of sprite in x coordinate
- y: gives the position of sprite in y coordinate
- Direction: Gives the direction of sprite.
Gliding the sprite to specific location
You can glide a sprite to specific location instead of moving it. When gliding it reaches its destination smoothly. Time taken to reach the destination can be specified.
To Glide:
- Click on motion blocks palette.
- Drag and drop glide block to script area.
- Specify the final location of sprite to glide to. Fill x and y coordinates
- Specify the time required to reach the destination
Given below is a sample script to glide your sprite from one location to another:
The sprite first glides position x = 40 y = 80 in one sec. Then it glides back to position x = -40 and y = -80. The process continues endlessly.
No comments:
Post a Comment