Your name Space Invader Worksheet This task is to practise the following programming concepts: Naming conventions Iteration Selection Variable Comments Getting started 1. 2. 3. 4. Save this worksheet in your own 1.46 folder. Copy the scratch project lesson5_space_invader.sb file in P drive into your own folder. Open Scratch 2 and choose File Open to open the above file. Rename the sprites with an appropriate name. Sequence = step by step In our first lesson, we learnt that computer programs are made of a sequence of instruction that the program follow step by step. Below are the first blocks of code for the enemy plane: Direction 90 is to the right Iteration = loops Add a forever loop to get your enemy plane to move: 1. Open the script for the plane 2. 3. 4. 5. Dock a forever block underneath this block: From the blue “move” menu, find a “move 10 steps” block. Place it inside the forever loop. Add a wait 1 second block inside the forever loop. Test your game, adjust the numbers if you want. Your name Add another loop to unstuck your plane from the edge. Your task will be to arrange the blocks in the correct loops so that the enemy plane scrolls across the screen. 1. Scroll down to the bottom of the control menu to find the “repeat until” block 2. In the sensing menu, select the first block “touching” and slide it in the condition slot of your repeat until block 3. Click the black triangle and select “edge”. Your loop and its condition should look like this: 4. Add the blocks to make the plane point in the opposite direction. We used these blocks before. 5. You will also need another “move 10 steps” blocks to help the plane move away from the edge. Note how I set mine to 30 steps. All these blocks have to be inside the forever loop you added question 2. Arrange the blocks together so that the plane scrolls across the screen. Selection = if <condition> Make the enemy plane disappear and re-appear at the top of the screen if it is hit by the bullet. 6. In order to keep on checking if the bullet hits, create a whole new block of code with a when green flag clicked followed by a forever if block. 7. Find the correct condition to use in the light blue sensing menu. You will need to set it to bullet. 8. You will also need the “hide” and “show” blocks from the purple looks menu and the “go to x y” block from the move menu. Variables Add a score variable to count the number of times the player hits the plane. 1. 2. 3. 4. 5. Test your game. Add an appropriate comment to each sprites code. Print screen or use the snipping tool to copy you code with comments to the following page. Write your name in the header, close the header. Print your page of code and comments.