O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Scratch
an introduction
Year 6
What is Scratch?
With Scratch, you can program your own interactive
stories, games, and animations.
It helps you to learn ...
Parrot Shooter
This is a nice little game to start off with.
You will be taught to make parrots fly on
random paths, then ...
Stage 1
Making the parrot move simply and then
"randomly"
Open Scratch and you will see the following window
with a brief note on the various functions.
Sprite Preview
Sprite Edito...
Tool Box is like a
bucket of Lego; it
provides single
script blocks for
building combo
script blocks.
Tool Box
Sprite Editor
Sprite Editor lets
you edit a Sprite’s
Scripts, Costumes,
and Sounds.
Sprite Preview
Sprite Preview lets you preview a project.
Sprite Selection and
Creation
Sprite Selection and Creation lets you
select an existing Sprite or create a new
Sprite.
As we all know cats do not fly so we need to
replace the cat with, in this case, a parrot.
Right-click on the cat and pres...
See cats don’t fly!
It’s merely an optical illusion…
We now need to find our flying parrot so,
click on the choose new sprite from file.
Double click on Animals in the new win...
Scroll down until you find parrot1-a.
Click on it and then press the OK button.
As you can see the parrot is a bit too big for
our game area (the white space around the
parrot) and even Mr Moore could s...
Now we need the parrot to fly around the
screen. If we press the green flag then this
would normally start our program scr...
Make sure that the parrot, Sprite1, in
the sprite selection and creation
window is selected.
Go to and select the Control ...
The next step is to get the parrot to move so, as
movement is motion, select the Motion tab and
drag the command into the ...
Now press the green flag and see what happens
to the parrot. Press it again,
Not very sensible to have to keep on pressing...
In the scripts area uncouple the
command from the
Click on the tab
Select the command and
Couple it with
Slot the under fo...
Now run your program
by clicking the green flag.
Wow! That was amazing NOT!!!!
Now let’s get the parrot to bounce back should it
hit an obstacle (i.e. the wall at the edge...
A bit better but the parrot looks as though it
doesn’t know which way up to fly.
Let’s remedy this before we carry on. Sto...
Before we carry on let us save what we have done
so far.
1.Stop the program.
2.Go to File and choose Save as from the drop...
Now we need to add some randomness into the
game otherwise shooting the parrot would be too
simple.
Let us look at some of...
Make sure that the tab is selected.
Find
And slot it under
Run the program.
A bit better but our poor parrot seems to be going
in circles. Not surprising as 15 degrees seems to be
quite a lot.
Chang...
Slightly better still but eventually the parrot ends
up going in a predictable pattern – not good for
games lovers!
boring
Now you change the move 10 steps to move 20
steps and see what happens.
Well, the parrot moves faster but, again, the
even...
Randomness in computer programming uses the
operators function. So, choose the green
operators tab just below the control ...
Do the same as before but this time for the
command. Do not change the
values 1 to 10 but leave them as they are.
Run the ...
Tea break (teachers only). Time to save your
work and ask any questions about anything you
do not understand.
Stage 2
Lots more parrots, a background and a
target.
Having only one parrot in the game to shoot
wouldn’t be very exciting so we are going to add
some more.
The easiest way to...
Now, besides copying the graphic – Sprite 1 to
Sprite 5
you will also notice that if you click on each of the
sprites it h...
Lovely background! It’s not very often that you see
parrots flying around the Arctic or Antarctic so we
now need to choose...
The background aspect of our game is called the
Stage.
Click on and you will see in the Scripts area
that there is no code...
Underneath the Backgrounds tab you will see that
you could, if you so wanted, Paint your own
background, Import one that h...
Now choose the Nature folder and then select
the Lake background.
Now we are going to need a target (cross-hair)
with which to shoot our parrots. We could import
one but instead we are goi...
Select the Ellipse tool.
Select Red as the main colour of your target.
As with most paint programs, to get a perfect circle
you just hold down the key on your
keyboard and draw at the same time.
Now we need to draw the cross-hair on our target
by using the Line tool and choosing Black.
It should now look like this …
When you are happy with your target and
crosshair click the OK button.
If your target is a little on the large size then s...
The next step is to get the target to move around the
screen. There are many ways to do this but to make it
simple at this...
As soon as you have run the program you will
notice that the target moves to the mouse-pointer
only once and then stops.
W...
Well, who suggested we use the Forever
command?
Well done if anyone did. Now do it and run the
program.
Coffee break (teachers only). Time to save your
work and ask any questions about anything you
do not understand.
Stage 3
Making the parrots disappear when shot
and then bringing them back to play again.
Now we come to the actual shooting aspect of the
game. The basic idea now is that when you shoot
the parrot it disappears....
Click on the first parrot, Sprite1
Select the tab
Find the command and place it
somewhere underneath your previous script
We now need to think carefully about what we
want our program to do. Simply, we want the
parrot to disappear (hide) when t...
Select the tab and
Drag the command onto
Now select the tab and
Drag the top command, , into the
space after the if command
Now we need to decide what the if command
refers to. Simply, if the first parrot (sprite1) is
touching the target (sprite ...
The final part of this line of code is to tell the parrot
to disappear (hide) if it is touching the target when
the spaceb...
Well, we have sorted out what happens to the
Sprite1 parrot but we need to do the same for the
other 4. Luckily we are abl...
Now follow these instructions VERY carefully!
In the Scripts section of Sprite1, click on the
instruction and DRAG it on t...
Check to make sure that the same lines of code
have been copied across to all the parrots by
selecting each of them in the...
Some of you may have noticed that even
when you have shot all the parrots they are
still flying in the background
Look her...
So, how do we get the parrots back again once they
have been hidden?
Simple.
Select the first parrot (Sprite1) and from th...
Now we want to show the parrots once the letter
a is clicked on the keyboard so go to the
tab and join the piece of code t...
Bathroom break (teachers only). Time to save
your work and ask any questions about
anything you do not understand.
Stage 4
Setting up the scoring system.
When designing any game it needs to decided at
the outset what the scoring system is to be.
For our game we are going to s...
The first thing we need to do is to create what is
called a variable.
Make sure that Sprite1 is selected.
Then click on th...
You will see underneath the variable section there
are only two options…
Click on Make a variable and give it the name
sco...
Hopefully, those of you who are looking carefully
will have noticed that a score board has
appeared in your play area.
Earlier on we said that every time you press the
spacebar then you lose 1 point. So, we need to
modify the code structure ...
If you are limited for
space between each
block of code then move
them down the screen
like that to the right.
split code
Under drag a block
For the mathematicians amongst you, you will
notice that we are adding 1 each time we press the
spaceba...
Under the hide piece of code we now need to
add the same piece of code as previously but this
time adding 10 each time. It...
This part is intentionally to show you what happens
when you do not do your initial planning correctly.
This is just the s...
The code we have just amended now needs to be
copied into that of the other 4 parrots. BUT, we
already have the old code s...
Now you need to copy the new code from
Sprite1 into the other 4 parrot sprites.
drag new
code
Now play the game. What do you notice about
the score every time we press the space bar?
Hopefully you will have noticed t...
Nearly there!
Now some of you will have noticed that when you
restarted the game it carried on where you left
off!
The nex...
Split the and code blocks
and drag in the variable to fill the space
between them. Reassemble into one block.
Finally some of you will again have noticed that
every time you make a hit the score only goes up
by 9 and not 10 as progr...
Game too fast for you?
Look at the coding and see which of the code
blocks you could change to slow the parrots
down.
Answ...
Exercise break (teachers only). Time to save
your work and ask any questions about
anything you do not understand.
Stage 5
Making it tough with a timer. Can you work
out how to get the "game over" message
up?
Last bit! This time we want to make the game
even trickier still.
We are going to make it so that the game finishes
after ...
To get the game to finish after
20 seconds we need to use a
timer. There is a timer under
the Sensing tab but this is not
...
The first thing we need to decide on is where to
put the timer. In this case it is more convenient to
put it with the back...
You will now see the clock appear under the
scoreboard in the players window.
If you do not want to have the clock
shown t...
Coding for the clock.
What we want to happen when the game starts is
to set the clock to 20 so that it will countdown
unti...
Now, as we have not thought through this aspect
of the coding in detail, we are going to follow our
instincts to what has ...
To do this we will now add in the
command from the tab and change the
repeat value to 20
Under the repeat 20 instruction w...
Now run your program and watch the clock. Did
you see how fast it went? It counted down really
fast. What we forgot to do ...
If you put the instruction under the
line of code you will notice that the
clock immediately takes 1 off. What you need to...
This is the final stretch of coding for the Shoot the
Parrot game.
If you remember a few slides back we wanted the
game to...
As you will have noticed, nothing happened. The
game just carried on. What we want to do now is
to sort out some code so t...
So you have it. Your very own
Parrot Shoot Game.
Scratch   parrot shoot game
Próximos SlideShares
Carregando em…5
×

de

Scratch   parrot shoot game Slide 1 Scratch   parrot shoot game Slide 2 Scratch   parrot shoot game Slide 3 Scratch   parrot shoot game Slide 4 Scratch   parrot shoot game Slide 5 Scratch   parrot shoot game Slide 6 Scratch   parrot shoot game Slide 7 Scratch   parrot shoot game Slide 8 Scratch   parrot shoot game Slide 9 Scratch   parrot shoot game Slide 10 Scratch   parrot shoot game Slide 11 Scratch   parrot shoot game Slide 12 Scratch   parrot shoot game Slide 13 Scratch   parrot shoot game Slide 14 Scratch   parrot shoot game Slide 15 Scratch   parrot shoot game Slide 16 Scratch   parrot shoot game Slide 17 Scratch   parrot shoot game Slide 18 Scratch   parrot shoot game Slide 19 Scratch   parrot shoot game Slide 20 Scratch   parrot shoot game Slide 21 Scratch   parrot shoot game Slide 22 Scratch   parrot shoot game Slide 23 Scratch   parrot shoot game Slide 24 Scratch   parrot shoot game Slide 25 Scratch   parrot shoot game Slide 26 Scratch   parrot shoot game Slide 27 Scratch   parrot shoot game Slide 28 Scratch   parrot shoot game Slide 29 Scratch   parrot shoot game Slide 30 Scratch   parrot shoot game Slide 31 Scratch   parrot shoot game Slide 32 Scratch   parrot shoot game Slide 33 Scratch   parrot shoot game Slide 34 Scratch   parrot shoot game Slide 35 Scratch   parrot shoot game Slide 36 Scratch   parrot shoot game Slide 37 Scratch   parrot shoot game Slide 38 Scratch   parrot shoot game Slide 39 Scratch   parrot shoot game Slide 40 Scratch   parrot shoot game Slide 41 Scratch   parrot shoot game Slide 42 Scratch   parrot shoot game Slide 43 Scratch   parrot shoot game Slide 44 Scratch   parrot shoot game Slide 45 Scratch   parrot shoot game Slide 46 Scratch   parrot shoot game Slide 47 Scratch   parrot shoot game Slide 48 Scratch   parrot shoot game Slide 49 Scratch   parrot shoot game Slide 50 Scratch   parrot shoot game Slide 51 Scratch   parrot shoot game Slide 52 Scratch   parrot shoot game Slide 53 Scratch   parrot shoot game Slide 54 Scratch   parrot shoot game Slide 55 Scratch   parrot shoot game Slide 56 Scratch   parrot shoot game Slide 57 Scratch   parrot shoot game Slide 58 Scratch   parrot shoot game Slide 59 Scratch   parrot shoot game Slide 60 Scratch   parrot shoot game Slide 61 Scratch   parrot shoot game Slide 62 Scratch   parrot shoot game Slide 63 Scratch   parrot shoot game Slide 64 Scratch   parrot shoot game Slide 65 Scratch   parrot shoot game Slide 66 Scratch   parrot shoot game Slide 67 Scratch   parrot shoot game Slide 68 Scratch   parrot shoot game Slide 69 Scratch   parrot shoot game Slide 70 Scratch   parrot shoot game Slide 71 Scratch   parrot shoot game Slide 72 Scratch   parrot shoot game Slide 73 Scratch   parrot shoot game Slide 74 Scratch   parrot shoot game Slide 75 Scratch   parrot shoot game Slide 76 Scratch   parrot shoot game Slide 77 Scratch   parrot shoot game Slide 78 Scratch   parrot shoot game Slide 79 Scratch   parrot shoot game Slide 80 Scratch   parrot shoot game Slide 81 Scratch   parrot shoot game Slide 82 Scratch   parrot shoot game Slide 83 Scratch   parrot shoot game Slide 84 Scratch   parrot shoot game Slide 85 Scratch   parrot shoot game Slide 86 Scratch   parrot shoot game Slide 87 Scratch   parrot shoot game Slide 88 Scratch   parrot shoot game Slide 89 Scratch   parrot shoot game Slide 90 Scratch   parrot shoot game Slide 91 Scratch   parrot shoot game Slide 92 Scratch   parrot shoot game Slide 93
Próximos SlideShares
Making your First Mobile App
Avançar
Transfira para ler offline e ver em ecrã inteiro.

2 gostaram

Compartilhar

Baixar para ler offline

Scratch parrot shoot game

Baixar para ler offline

Creating a parrot shooting game using Scratch software.

Audiolivros relacionados

Gratuito durante 30 dias do Scribd

Ver tudo

Scratch parrot shoot game

  1. 1. Scratch an introduction Year 6
  2. 2. What is Scratch? With Scratch, you can program your own interactive stories, games, and animations. It helps you to learn to think creatively, reason systematically, and work collaboratively — essential skills for life in the 21st century. Scratch is designed especially for ages 8 to 16, but is used by people of all ages. Millions of people are creating Scratch projects in a wide variety of settings, including homes, schools, museums, libraries, and community centres.
  3. 3. Parrot Shooter This is a nice little game to start off with. You will be taught to make parrots fly on random paths, then shoot them and make them disappear. For good measure you will be shown how to keep the score and set a timer to shoot all the parrots within.
  4. 4. Stage 1 Making the parrot move simply and then "randomly"
  5. 5. Open Scratch and you will see the following window with a brief note on the various functions. Sprite Preview Sprite Editor Sprite Selection and Creation Tool Box
  6. 6. Tool Box is like a bucket of Lego; it provides single script blocks for building combo script blocks. Tool Box
  7. 7. Sprite Editor Sprite Editor lets you edit a Sprite’s Scripts, Costumes, and Sounds.
  8. 8. Sprite Preview Sprite Preview lets you preview a project.
  9. 9. Sprite Selection and Creation Sprite Selection and Creation lets you select an existing Sprite or create a new Sprite.
  10. 10. As we all know cats do not fly so we need to replace the cat with, in this case, a parrot. Right-click on the cat and press delete.
  11. 11. See cats don’t fly! It’s merely an optical illusion…
  12. 12. We now need to find our flying parrot so, click on the choose new sprite from file. Double click on Animals in the new window that opens.
  13. 13. Scroll down until you find parrot1-a. Click on it and then press the OK button.
  14. 14. As you can see the parrot is a bit too big for our game area (the white space around the parrot) and even Mr Moore could shoot something that big! Select the Shrink sprite button. Move it onto the parrot and keep on clicking until the parrot is about the right size.
  15. 15. Now we need the parrot to fly around the screen. If we press the green flag then this would normally start our program script but, as we have not written any script yet, nothing will happen.
  16. 16. Make sure that the parrot, Sprite1, in the sprite selection and creation window is selected. Go to and select the Control tab in the tool box area then drag the command to the Sprite editor in the Scripts area.
  17. 17. The next step is to get the parrot to move so, as movement is motion, select the Motion tab and drag the command into the scripts area and attach it underneath the command. Hopefully you will begin to notice that certain commands will slot nicely into others if they complement each other. Just like a jigsaw puzzle.
  18. 18. Now press the green flag and see what happens to the parrot. Press it again, Not very sensible to have to keep on pressing the green flag – especially when you are playing the game! So, the next step is to make the parrot move forever.
  19. 19. In the scripts area uncouple the command from the Click on the tab Select the command and Couple it with Slot the under forever.
  20. 20. Now run your program by clicking the green flag.
  21. 21. Wow! That was amazing NOT!!!! Now let’s get the parrot to bounce back should it hit an obstacle (i.e. the wall at the edge of the sprite preview window in this case). Click on the tab Towards the bottom select and slot this this just under Press the green flag.
  22. 22. A bit better but the parrot looks as though it doesn’t know which way up to fly. Let’s remedy this before we carry on. Stop the program script. Above the Scripts tab there are three little command buttons just to the left of the parrot. Select the middle button that says only face left- right Run the program
  23. 23. Before we carry on let us save what we have done so far. 1.Stop the program. 2.Go to File and choose Save as from the drop- down menu 3.Click on the Computer tab on the left and choose letter Y or 4.Choose Year 6, your class, your name and save the program as Parrot Shoot Game.
  24. 24. Now we need to add some randomness into the game otherwise shooting the parrot would be too simple. Let us look at some of the possibilities that we now have and choose the best one/s for our game. Let us see what happens when we, say, change direction by 15 degrees after each 10 steps.
  25. 25. Make sure that the tab is selected. Find And slot it under Run the program.
  26. 26. A bit better but our poor parrot seems to be going in circles. Not surprising as 15 degrees seems to be quite a lot. Change the 15 degrees to 5 and see what happens.
  27. 27. Slightly better still but eventually the parrot ends up going in a predictable pattern – not good for games lovers! boring
  28. 28. Now you change the move 10 steps to move 20 steps and see what happens. Well, the parrot moves faster but, again, the eventual pattern is predictable. So let us now add some randomness into our parrot’s movements.
  29. 29. Randomness in computer programming uses the operators function. So, choose the green operators tab just below the control tab you have been using up to now. About a quarter of the way down the list you will see the instruction. Drag one of these into the box that says ‘20’ in the Change the numbers 1 to 10 to 10 to 30
  30. 30. Do the same as before but this time for the command. Do not change the values 1 to 10 but leave them as they are. Run the program.
  31. 31. Tea break (teachers only). Time to save your work and ask any questions about anything you do not understand.
  32. 32. Stage 2 Lots more parrots, a background and a target.
  33. 33. Having only one parrot in the game to shoot wouldn’t be very exciting so we are going to add some more. The easiest way to do this is to right click on our parrot and choose the duplicate command from the menu. Do this so that there are (say) 5 parrots on the screen. Move them about so they are not on top of each other.
  34. 34. Now, besides copying the graphic – Sprite 1 to Sprite 5 you will also notice that if you click on each of the sprites it has also copied the code. This re-use of code in computer programming is very import and useful. Now run your program.
  35. 35. Lovely background! It’s not very often that you see parrots flying around the Arctic or Antarctic so we now need to choose a suitable background image.
  36. 36. The background aspect of our game is called the Stage. Click on and you will see in the Scripts area that there is no code but, at the top, are three tabs click on Backgrounds
  37. 37. Underneath the Backgrounds tab you will see that you could, if you so wanted, Paint your own background, Import one that has been saved previously or even import one from your Camera. Today we are going to import one that has already been saved. So, click on the Import tab.
  38. 38. Now choose the Nature folder and then select the Lake background.
  39. 39. Now we are going to need a target (cross-hair) with which to shoot our parrots. We could import one but instead we are going to paint our own. Firstly - click on the Paint new sprite icon
  40. 40. Select the Ellipse tool. Select Red as the main colour of your target.
  41. 41. As with most paint programs, to get a perfect circle you just hold down the key on your keyboard and draw at the same time.
  42. 42. Now we need to draw the cross-hair on our target by using the Line tool and choosing Black. It should now look like this …
  43. 43. When you are happy with your target and crosshair click the OK button. If your target is a little on the large size then shrink it down.
  44. 44. The next step is to get the target to move around the screen. There are many ways to do this but to make it simple at this stage we are going to use the mouse pointer. In the Scripts area of the target drag in a command, go to the tab and then drag the instruction underneath it. After the words go to there is a black down arrow. Select this and choose mouse-pointer at the top.
  45. 45. As soon as you have run the program you will notice that the target moves to the mouse-pointer only once and then stops. Why do you think that is the case and what command do you think we need to use to resolve the dilemma?
  46. 46. Well, who suggested we use the Forever command? Well done if anyone did. Now do it and run the program.
  47. 47. Coffee break (teachers only). Time to save your work and ask any questions about anything you do not understand.
  48. 48. Stage 3 Making the parrots disappear when shot and then bringing them back to play again.
  49. 49. Now we come to the actual shooting aspect of the game. The basic idea now is that when you shoot the parrot it disappears. We will think about, later on, what to do when all the parrots have disappeared. The first thing we need to decide on is what key to use on the keyboard to shoot the parrot to keep things simple we will use the …
  50. 50. Click on the first parrot, Sprite1 Select the tab Find the command and place it somewhere underneath your previous script
  51. 51. We now need to think carefully about what we want our program to do. Simply, we want the parrot to disappear (hide) when the spacebar is pressed and the parrot is touching the target. So, our code should recognise that when the space bar is pressed, if the parrot is touching the target, then it disappears (hides).
  52. 52. Select the tab and Drag the command onto Now select the tab and Drag the top command, , into the space after the if command
  53. 53. Now we need to decide what the if command refers to. Simply, if the first parrot (sprite1) is touching the target (sprite 6 in this case) then that parrot will disappear (hide). So after touching we need to choose Sprite 6 from the drop-down list.
  54. 54. The final part of this line of code is to tell the parrot to disappear (hide) if it is touching the target when the spacebar is pressed. Select the tab and drag the instruction into the blank space under the if command. Run the program and try it out.
  55. 55. Well, we have sorted out what happens to the Sprite1 parrot but we need to do the same for the other 4. Luckily we are able to use the same coding for Sprite1 for the other 4 Sprites (parrots). Make sure Sprite1 is selected…
  56. 56. Now follow these instructions VERY carefully! In the Scripts section of Sprite1, click on the instruction and DRAG it on top of Sprite 2. Sprite 2 should have a GREY GLOW about it when you let go of the commands you want to copy. Do exactly the same for the rest of the parrots
  57. 57. Check to make sure that the same lines of code have been copied across to all the parrots by selecting each of them in the Sprites window. Run the program and play the game.
  58. 58. Some of you may have noticed that even when you have shot all the parrots they are still flying in the background Look here to see each of their movements. We haven’t killed the parrots – we’ve just hidden them.
  59. 59. So, how do we get the parrots back again once they have been hidden? Simple. Select the first parrot (Sprite1) and from the tab drag in another command. From the drop-down menu arrow after space choose the letter a.
  60. 60. Now we want to show the parrots once the letter a is clicked on the keyboard so go to the tab and join the piece of code to Now copy the new code to the other 4 parrots and run the game using the a key to get them all back.
  61. 61. Bathroom break (teachers only). Time to save your work and ask any questions about anything you do not understand.
  62. 62. Stage 4 Setting up the scoring system.
  63. 63. When designing any game it needs to decided at the outset what the scoring system is to be. For our game we are going to say that … • Every time you press the spacebar you lose 1 point • Every time you hit a parrot you get 10 points • Maximum score 50
  64. 64. The first thing we need to do is to create what is called a variable. Make sure that Sprite1 is selected. Then click on the tab.
  65. 65. You will see underneath the variable section there are only two options… Click on Make a variable and give it the name score Leave the For all sprites button selected as this variable will apply to all parrots
  66. 66. Hopefully, those of you who are looking carefully will have noticed that a score board has appeared in your play area.
  67. 67. Earlier on we said that every time you press the spacebar then you lose 1 point. So, we need to modify the code structure … As soon as the player presses the space key we want 1 point to be deducted so we need to split the code when space key pressed and if touching Sprite6
  68. 68. If you are limited for space between each block of code then move them down the screen like that to the right. split code
  69. 69. Under drag a block For the mathematicians amongst you, you will notice that we are adding 1 each time we press the spacebar rather than taking 1 away. So, change the 1 to -1. The next part is similar to the above. If you remember we said earlier on that Every time you hit a parrot you get 10 points so we need to change if touching sprite 6 code as well.
  70. 70. Under the hide piece of code we now need to add the same piece of code as previously but this time adding 10 each time. It should now look like this once the code blocks have been joined back together again …
  71. 71. This part is intentionally to show you what happens when you do not do your initial planning correctly. This is just the same as what happens in planning a Science investigation or a design and technology activity. Bad planning means EXTRA work! Coding is no different and can add many hours of time to computer programming if the project is not minutely planned from the outset.
  72. 72. The code we have just amended now needs to be copied into that of the other 4 parrots. BUT, we already have the old code still in each of them. So you will have to go to Sprites2, 3, 4 & 5 and delete the old code by dragging it to the window on the left. drag out old code
  73. 73. Now you need to copy the new code from Sprite1 into the other 4 parrot sprites. drag new code
  74. 74. Now play the game. What do you notice about the score every time we press the space bar? Hopefully you will have noticed that the score doesn’t drop by 1 but by 5! This is because we have the same command for each of the 5 parrots which means if we press the space bar we lose 5 x 1 off our score. To remedy this change the to -0.2 each time and do this for all parrots
  75. 75. Nearly there! Now some of you will have noticed that when you restarted the game it carried on where you left off! The next step is to return the scoreboard to zero when a new game is started. Make sure that the first parrot is selected (Sprite1)
  76. 76. Split the and code blocks and drag in the variable to fill the space between them. Reassemble into one block.
  77. 77. Finally some of you will again have noticed that every time you make a hit the score only goes up by 9 and not 10 as programmed. This is because you do gain 10 but also lose 1 for using the space bar! To make the game fair change the to Do the same for all 5 parrots. Now play the game.
  78. 78. Game too fast for you? Look at the coding and see which of the code blocks you could change to slow the parrots down. Answer on next slide for those who are unable to work it out.
  79. 79. Exercise break (teachers only). Time to save your work and ask any questions about anything you do not understand.
  80. 80. Stage 5 Making it tough with a timer. Can you work out how to get the "game over" message up?
  81. 81. Last bit! This time we want to make the game even trickier still. We are going to make it so that the game finishes after 20 seconds! This means that you only have 20 seconds to gain a score of 50 or more!
  82. 82. To get the game to finish after 20 seconds we need to use a timer. There is a timer under the Sensing tab but this is not suitable for our game. This timer just keeps on running from 1 onwards. We need a timer that will count down from 20 to zero and then stop the game.
  83. 83. The first thing we need to decide on is where to put the timer. In this case it is more convenient to put it with the background (stage). So, click on the stage icon where you will find no scripts at the moment. We are now going to use another variable so click on the tab and choose . When the dialogue window opens name the new variable clock then press OK.
  84. 84. You will now see the clock appear under the scoreboard in the players window. If you do not want to have the clock shown then deselect the clock option in the variables panel on the left. Alternatively, drag the clock to the right-hand side of the players window (or wherever else you want it)
  85. 85. Coding for the clock. What we want to happen when the game starts is to set the clock to 20 so that it will countdown until zero. Drag in the command under the tab and then, under the tab drag in and change the zero to 20.
  86. 86. Now, as we have not thought through this aspect of the coding in detail, we are going to follow our instincts to what has to be done next (not the right way to do it but hopefully we will learn by our mistakes next time). We want the clock to count down 20 times until it reaches zero.
  87. 87. To do this we will now add in the command from the tab and change the repeat value to 20 Under the repeat 20 instruction we want to add the command found under the tab. As we are counting down we need to change the variable to -1
  88. 88. Now run your program and watch the clock. Did you see how fast it went? It counted down really fast. What we forgot to do was to tell the clock to wait 1 second after each repeat command. So, go to the tab and insert the line of code. Where do you think it goes? Have a go.
  89. 89. If you put the instruction under the line of code you will notice that the clock immediately takes 1 off. What you need to do is put the instruction just before the line of code. Run your program.
  90. 90. This is the final stretch of coding for the Shoot the Parrot game. If you remember a few slides back we wanted the game to stop when the clock reached zero. If you run the game watch the clock and see what happens when the clock reaches zero. This should only take you 20 seconds – I wonder why…
  91. 91. As you will have noticed, nothing happened. The game just carried on. What we want to do now is to sort out some code so that when the clock reaches zero the game stops. This is very simple. Go to the tab and insert the command at the very end.
  92. 92. So you have it. Your very own Parrot Shoot Game.
  • ShaimaaAbdElKader1

    Nov. 6, 2017
  • hankrah

    Jan. 16, 2016

Creating a parrot shooting game using Scratch software.

Vistos

Vistos totais

1.190

No Slideshare

0

De incorporações

0

Número de incorporações

95

Ações

Baixados

31

Compartilhados

0

Comentários

0

Curtir

2

×