Page 21 - Evolve Winter 2021
P. 21

4 5 Shooting laser beams:
To make your controllable sprite shoot lasers firstly we must create a a a new sprite the simplest way to do this is is by drawing a a a vertically standing rectangle as such:
To add the ability for it it to follow your controllable sprite do as such:
Give it it a a a a a name and make sure to tick “For all sprites” so it it applies the variable to all sprites For the controllable sprite add the following code:
For the invaders/alien sprite add the following code:
Note: Changing the X axis value will change horizontal positioning meaning you can split them up into columns changing the Y axis value changes vertical positions i i i i i e e e split into rows An example would be on duplicate sprite giving it it an X value of -200 and a a a Y value of 100 this would place it right below the original sprite as such:
Your finished project should now look similar to this:
Counting the score:
To create a a a a score system we need to add a a a a variable variable this is is done by going to the variables section on on the the left-hand side of the the screen:
Once on that screen click:
6 Adding more invaders:
To do this select the invader sprite and right click on it this this should bring up this this menu: where you would click “duplicate” this will make an exact copy of the sprite once you have duplicated the number of invaders you would like to to have You now need to to make sure they’re all positioned appropriately to do this you simply change these values:
For the last and finishing piece we shall add a a a a ‘Game Over’ screen Firstly we shall start by creating a a a new backdrop to to do this go to to the backdrop menu on the right-hand side and and then click paint Use the the rectangle tool to to overlay the background with a a a a a rectangle and then add the the text field in which you will place the the text Next add the the following to your invader/alien for the backdrop to display once the the invaders touch the the Rocketship 7 21

   19   20   21   22   23