Movement and Direction of sprite
Click on the sprite from sprite list to select any sprite.

Movement
Select Motion Block from Block palette.
Drag “move 10 steps” block and drop it into the script area. You can change the value of steps to any number by clicking on the number and then inputting the number using keyboard.
For example, in the below figure the value has been changed to 50. To move the sprite in left direction enter negative values.
When you double Click on the block, you can see the sprite moving 50 steps in the stage area
Direction
Direction of the sprite can be changed through rotations. Rotation can be done by selecting the icons as shown below.
Three types of rotation styles are possible.
Can rotate style:
To rotate your sprite in clockwise or anticlockwise directions about a central point. Select the ‘Can Rotate’ icon by clicking on it (selected style will be highlighted) and then to define the angle of rotation drag “turn 15 degrees clockwise” block to script area as shown below. 
When you click the block, the output on the stage can be seen as shown below.
Similarly ‘turn 15 degrees anticlockwise’ block will turn the sprite in the opposite direction. Positive values rotate in the selected direction whereas negative number rotates in counter direction. i.e ‘turn 15 degrees clockwise’ and ‘turn -15 degrees anticlockwise’ will do the same action.
Only face Left Right Style
When “Only face Left-Right” is selected, the sprite's rotates its direction to right and left. Use “turn 15 degree” allows us to flip the sprite. If the direction is between 0 to 180, the sprite will not appear rotated. If the direction is between 0 to -180, the sprite will be flipped over the Y-axis.
For example, if “turn 180 degrees” block is dragged to the script area and run the script, then the sprite faces left direction as shown below.
Don't rotate style
Don't rotate prevents all rotation. But on moving your sprite it will move in the direction set.
For Example, if the sprite is facing in direction 90 and is at x= 0, y = 0. On turning the direction by 90 degrees anticlockwise and moving 50 steps will lead to x= 0 and y = 50.
Other Move Block Options
Changes the direction of sprite to 90 = Right,
-90 = Left, 0 = up, 180 = down.
| |
Points sprite toward mouse-pointer or another sprite.
| |
Moves sprite to specified x and y position on Stage.
| |
Moves sprite to the location of mouse pointer or any other sprite.
| |
Moves sprite to specified location smoothly over the specified period of time.
| |
Changes location on x axis by specified number. Similar block for y axis exists.
| |
Set the x axis location of the sprite. Similar block for y axis exists.
| |
Turns the direction of the sprite when it reaches the edge of the screen.
| |
Displays the current coordinate of sprite's in x direction. Similar block for y direction also exists.
| |
Displays the angular direction of the sprite.
|
No comments:
Post a Comment