Download presentation
Presentation is loading. Please wait.
Published byAvice Atkinson Modified over 9 years ago
1
www.computerscienceuk.com Programming a Shooter Game Design
2
www.computerscienceuk.com Starter On your whiteboards write down an example script block to get a sprite moving right when the right arrow is pressed.
3
www.computerscienceuk.com Learning Objectives – To understand how to use variables to record the direction of the character – To understand how to program the firing of a bullet from your main character. Success Criteria – To develop the platform game (started last week) so that the character can fire a bullet left and right. Literacy – Key Words Variable‘Storage box’ used in programming to store data SpriteProgrammable objects in Scratch ScriptsBlocks of programming code in Scratch
4
www.computerscienceuk.com Hands up if you know how to program a shooter in Scratch?
5
www.computerscienceuk.com What needs to happen to create a shooter? Planning 1.We need a main character 2.We need an object to fire 3.We need out object to follow (attach to) the main character 4.When the cat is facing right, we want the object to move to the right when we press space 5.When the cat is facing left, we want the object to move to the left when we press space
6
www.computerscienceuk.com How can we record if the character is facing right of left? Answer: We can use a variable which can be set to: 0 when the left arrow key is pressed 1 when the right arrow key is pressed
7
www.computerscienceuk.com 1. Use a variable to record which way the main sprite is facing 1 2 3 Main Character!!
8
www.computerscienceuk.com Whiteboard Practice Write the script to move the sprite left when the left arrow is pressed. The script must also set a variable to 0 (so that the direction can be recorded)
9
www.computerscienceuk.com Whiteboard Practice…again Write the script to move the sprite right when the right arrow is pressed. The script must also set a variable to 1 (so that the direction can be recorded)
10
www.computerscienceuk.com Demonstration of Shooter How is this done?
11
www.computerscienceuk.com 2. Program the shooter (object firing) After we press the green flag We check if the space is pressed If it is and the direction is left (0), the bullet points to the left (-90), it is shown and it moves 10 steps. This is repeated until the bullet hits the edge of the stage. If the space is pressed and the direction is right (1), the bullet points to the right (90), it is shown and it moves 10 steps. This is repeated until the bullet hits the edge of the stage. If however, the space is not pressed, the bullet hides and stays permanently with the main character.
12
www.computerscienceuk.com Hands up if you know how to program a shooter in Scratch?
13
www.computerscienceuk.com Write down on your whiteboard, in your own words, how this script works 3 minutes
14
www.computerscienceuk.com 2. Program the shooter (object firing) After we press the green flag We check if the space is pressed If it is and the direction is left (0), the bullet points to the left (-90), it is shown and it moves 10 steps. This is repeated until the bullet hits the edge of the stage. If the space is pressed and the direction is right (1), the bullet points to the right (90), it is shown and it moves 10 steps. This is repeated until the bullet hits the edge of the stage. If however, the space is not pressed, the bullet hides and stays permanently with the main character.
15
www.computerscienceuk.com Programming Task 1 and 2 Open the Lesson Task Sheet and complete the tasks ’20 Minutes’ 1.Open your semi completed game from last week (a sprite that jumps from platform to platform). 2.Create a variable (call it direction) and adapt your movement scripts so that direction = 0 when the left arrow is pressed and direction = 1 if the right arrow is pressed. Then print screen your script and explain how it works in the worksheet. 3.Create a bullet sprite. 4.Add a script to your bullet sprite so that it follows the main character (hidden) and fires in the correct direction when a key of your choice is pressed. Then print screen your script and explain how it works in the worksheet. Use this presentation for support if you require it.
16
www.computerscienceuk.com Assessment Criteria LevelProgramming Skills 7 I fully understand how the script programs the shooter and my explanations are detailed and clearly show my understanding. I can create the correct script blocks without help. I can see how other objects can be programmed in a similar way. 6 I understand how the scripts programs the shooter and my explanations are detailed and clearly show my understanding. I can create the correct script blocks without help. 5 I generally understand how the scripts create the shooter but my explanation is brief and not that clear. I can create the correct script blocks but do need a little help from the help guides. 4 I don’t fully understand how the scripts program the shooter. I struggle to make the correct script blocks to program the shooter.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.