This add-on will keep score in your game, so that each time you complete a pass to areceiver, the score will go up. After finishing this add-on, challenge your fellow club membersto see who gets the highest score! Go to the data menu, click "make a variable,"name it "score," and click "OK." Computers store changing information in variables. Inthis case, you're going to put the score in the variable, so the computer can keep trackof the current score. Next, do two things: start the score at zero,and raise the score by one each time a pass is completed.
To do this, first, click on the ball sprite. At the top of the code stack, just under the"when flag clicked" block, place a "set variable to" block. Make sure that "score" is selectedin the dropdown, then enter zero in the value space. This will make the score start at zeroevery time the flag is clicked. For the second task, make the score go upeach time one of the receivers touches the ball. Click on a receiver sprite to see thatyou've already programmed a conditional that checks if the receiver is touching the football.
Into this conditional, place a "change variable" block. Make sure that "score" is selectedin the dropdown, then type “one” into the value blank if it's not there already.
This conditional reads: if the receiver is touching the ball sprite, add one to the score.
Great. But, there are three receiver sprites in this example, and the score should go upif any one of them is touched. Add the same "change variable" block to the script foreach receiver sprite in your project. Finally, to see the score, check the box nextto the score variable in the data menu. Test it by playing around a bit. Watch the scorego up by one each time you hit a receiver, then watch it start over at zero each timeyou click the flag. Here's the game plan:Make a variable called “score.” Set the score to zero each time the game starts.
Increase the score by one every time a receiver touches the ball sprite.
Choisir une extension
Renvoyer le ballon
La balle rebondira toujours à la position de départ.
Puissance / vitesse du receveur
Ajoute des variables réalistes avec des curseurs qui contrôlent la vitesse de la balle et celle des lutins Receveurs.
Enregistrer le score
Comptabilise le nombre de passes que tu as réussies.