Start a new Scratch project - "File" and then "New"
Making the tank involves using the imported graphics.
Open the folder Student share / Department\Computing / _2017-2018 / KS3 / Year 8 / Tanks
You will need this folder more than once so keep it open.
Drag the tank body onto the cat and let go. the cat will become the tank body.
Click on costumes ...
,,, and remove the cat costumes.1. Screenshot your project so far and describe how you changed the cat sprite into the tank sprite.
In the same way we made the girl move in project 3 we could make the tank move...
... however the tank does not move like a tank should so start again.
We will use the up arrow to set the speed and the left and right arrows to steer the tank; like this...
... strangely the tank will move in a peculiar fashion and turn in an equally non-tank like way.
The first part of the solution is to make sure that the sprite is centred correctly. Edit the tank costume and click on "Set costume center" (Don't you just love American spelling mistakes). Move the cross hairs so that they are centred on the middle of the tank. Press "OK"
Next you will notice the the tank sort of crabs sideways rather than drives in the direction it is pointing.
In the image below I have highlighted the icons that you can use to turn the sprite left and right and I have highlighted the little image that shows the direction of movement of the sprite. You need to rotate the sprite so that the direction of movement is the same as the direction the tank is facing...
Now the tank moves more like a tank should; it does move and turn a little quickly so change the script to make it slower, like this.
Screenshot your project so far and describe importing the tank body sprite and maing the tank sprite move.2. Screenshot your project so far and describe how you made the tank move.
You could add the turret by adding a new sprite from a file or you can add a surprise sprite and then drop the turret on top.
So "get a surprise sprite"...
... and then drop the turret on to the top of it. My surprise sprite turned out to be a carpet but the next step is to delete it as a costume, just leaving the turret.
Again you have to align the turret correctly so that it will turn and point as you will want it to do.
Edit the turret costume and make the turret point the same way as the blue line (use the right and left icons) ...
... and then use "set costume center" to put the cross hairs on the centre of the turret; one of the cross hairs must go down the centre of the barrel.3. Screenshot your project so far and describe how you made the turret face the right way.
Firstly have you noticed that I have changed the names of the sprites to be "tank" and "turret"? This makes some of the code easier to understand and to write.
Next, we need to add a script to the turret to make it point at the mouse pointer...
Try it an you will see that as the tank moves the turret will stay as part of the tank and it will always point at the mouse-pointer.
Screenshot your project so far and describe adding the turret sprite to the tank sprite so that they move together as a single sprite.4. Screenshot your project so far and describe how you added the turret to the tank.
The first thing to do is to "paint a new sprite" ...
... which is to be a gun sight, a circle and a cross; just like the one in the picture below...
... then using the "set costume center" option centre the cross hairs on the exact centre of the gun sight sprite.
Finally add a script to the gun sight so that it is always where the mouse pointer is...
... and name the sprite "gun sight".
Screenshot your project so far and describe adding the gunsight sprite.5. Screenshot your project so far and describe how you made the gun sight.
Again, the first thing to do is to "paint a new sprite", zoom in using the zoom controls that I have highlighted and draw a sort of bullet shape...
... and press "OK".
The next step is to work out what happens when the projectile is fired in terms of the sprites that are already created.
In effect the projectile starts of at the turret and flies to the x y coordinate of the gun sight. How can this be done as a script for the projectile?
Firstly add a "goto " block and make the projectile go to the turret...
... then it needs to "point towards" the gun sight...
... then it needs to glide to x y where x and y are the x y position of the gun sight.
one of the sensing blocks will tell the projectile what the x or y coordinate of the gun sight sprite...
... so this can be added to the script. Note that I have shrunk the window for the outputs so that the script window is big enough to see all the script.
Try it and see that the projectile now takes a second to get from the gun to the target, although at the moment, nothing happens when it gets there.6. Screenshot your project so far and describe how you made the projectile.
Ah, an explosion! This time you will make use of the fact that scratch can change costumes quickly to make the projectile explode.
Add all of the explosions from the "Tanks" folder to the projectile sprite; just drag them and drop them onto the sprite.
There are now 10 costumes for the projectile, the original bullet shape and the 9 explosion images.
Now edit the script for the projectile.
At the start the projectile sprite must be hidden and it must be the bullet shape - the first 2 blocks.
Then there is a repeat 10 loop (10 because there are 10 costumes) that changes to the next costume.
Finally the projectile is hidden from view.
Try this and see if it works like this!7. Screenshot your project so far and describe adding explosions to the game.
This is easy enough. Switch to the stage and then background as in previous projects) and drop the "ground" from the "Tanks" folder onto the project.8. Screenshot your project so far and describe how you added terrain to the game.
You will have noticed that there are traffic cones in the graphics folder. Add a number of these at random to the game and add a script to that the game ends if the tank touches one. The tank can of course shoot the traffic cones.
Add solid objects for the tank to drive round such as small houses (Easy to draw, a rectangle and 5 lines with a shaded fill)
Add a scoring system, add points for hitting cones and deduct points for hitting houses.
Make the houses about the same size as a tank, maybe a little bigger.9. Screenshot your project so far and describe how you made the game more complicated.
Add a car moving through the ground for the tank to shoot at. The car should avoid the houses and cones.
Go back to the race game and add the explosion to the race car so that it looks even better.10. Screenshot your project so far and describe how you added terrain to the game.