Watch the screencast for the archery program:
This task introduces variables. When you have variables in your program, the computer has set aside a small area of its memory to store information. You can use variables to store important information about a game, such as your score, the number of lives you have left, how much time is left and much much more.
First you will need to import the background and sprites for the game. Download the pictures below:
Now we need create the scripts to make the game work. There are two algorithms we need to implement.
Try to create the game using the algorithms below rather than using the screencast:
* x is a random number from -240 to 240, y is a random number from -180 to 180
Test your game to make sure that it works.
Change your code to make the program count misses as well as hits (taking off 1 point from the score). The algorithm below shows you how you should change the part of the script that keeps track of the score.
Add a timer variable to your program which makes the game last 30 seconds. Make the variable appear on the screen as it counts down from 30 to 0.
Download and complete the written task in a word document. Remember to write your answers in full sentences:
Using if and touching colourblocks, change the program so that when the target is hit, it adds the following to the score:
Adapt the program so that the user will never get a negative score. Hint: take off a point only if the score is above zero.