Gliding From One Point to Another

Gliding From One Point to Another

1.  Click and drag your Sprite on the Stage to the location you want your Sprite to begin, each time you run your code.


This will change the x-coordinate and y-coordinate of your Sprite in the Sprites Pane.



2.  Click and drag a ‘when this sprite clicked’ block from the yellow Events category in the Block Palette on to the Code Area. This block will tell your code to run when you click on your Sprite on the Stage.


3.  Click and drag a ‘go to x: y:’ coordinates block from the Motion category in the Block Palette on to the Code Area. This block will tell your Sprite where to begin on the Stage when you run your code. You will notice that the x-coordinate and y-coordinate inside the block match the x-coordinate and y-coordinate of your Sprite in the Sprites Pane.


4. Click and drag a ‘wait 1 seconds’ block from the Control category in the Block Palette on to the Code Area. This wait block will tell your Sprite to wait a specific amount of seconds before gliding to its next given x-coordinate and y-coordinate. You can change the number of seconds in the white bubble on the block.


5. Click and drag your Sprite on the Stage to the next location you want your Sprite to move to. In the image below, I dragged my Sprite to the bottom of the ladder.


This will change the x-coordinate and y-coordinate of your Sprite in the Sprites Pane.


6. Click and drag a "glide 1 secs to x: y:" coordinate block from the Motion category in the Block Palette onto the Code Area. This block will tell your Sprite to glide for 1 second to the new x-coordinate and y-coordinate. You will notice that this block will have the x-coordinate and y-coordinate from the last step.


7. Test your code by clicking on your Sprite on the Stage!



Views
1 Total Views
1 Members Views
0 Public Views
Share on Social Networks
Share Link
Share by mail

Please login to share this webpage by email.