Create a more interesting animation by making a sprite do more than just turn and move in response to a key press. You could program far more than just four keys!
Import a new sprite such as a dancing figure (the break dancer has four costumes).
Import the additional break dance costumes so you have all four.
Add more costumes by changing the ones provided, for example by rotating them into new positions that your routine requires.
To do this click on Costumes and then Paint. Import the sprite you are using and use the tools to rotate it. Then use the Switch to Costume command from Looks to link the key press to the appropriate costume.
Add a suitable background - you could import one from a picture you find on the web.
Add a music track - Scratch will load mp3s.
Write controls for the dancer so that you can make him/her keep time with the music. You can work out complicated moves and link them to a range of keys.
Set up key presses to make the dancer move. Example
Note the use of the glide command with expressions for y + 50 and y - 50. We use the x position and y position variables to keep the sprite on the same y axis and change the x axis with a value. We could easily reverse this to produce movement on the y axis or change both at once. You will find the expression holders in the Operators section of Scratch.
Extension: Add a second sprite with its own keyboard controls so that another player could control the sprites.
Extension: Make the two sprites jump back if they collide. For this you will need a new green flag hat with a forever if block. Use the condition in Sensing touching? This allows you to detect when one sprite overlaps with another.
Summarise the actions of the code you have written. Include a section on each block of code and the algorithm it contains. Include at least one flow chart in your account. Get used to the idea of documenting your code ideas so that you retieve your thoughts later, communicate them to others and develop formal skills of analysis and design.
Write a program in Scratch to simulate a bouncing ball.
As before, you should follow the problem solving method of:
You need to specify the behaviour of the ball. Do this by asking how a ball behaves, discuss with partner, draw a diagram.
Then you need to plan your solution.
Where should the ball be placed? What will start it falling? How will it behave as it falls?
If downward movement is a positive change in y position, what is upward movement? (You could reverse these so that down is negative and up is positive; just be careful when selecting movement statements - move or change?)
How can you change a positive value into its negative equivalent? When does the bouncing ball's direction of movement change? When does the change in movement change from positive to negative?
What quantities do you need to set in order to model a falling and bouncing object such as a ball? How will you represent these quantities? What starting values will they have?
If you use variables set them to display on screen so you can observe changes as the simulation proceeds. Use a delay in the code to make it easier to view changes in the variables.
Now apply the same movements to a sprite that bounces on a trampoline whilst trying to avoid certain flying objects and to catch others. Add a score for caught objects and 'lives', which are lost when other objects hit the bouncing object.