www. programming a shooter game design

16
www.computerscienceuk.com Programming a Shooter Game Design

Upload: avice-atkinson

Post on 18-Jan-2018

218 views

Category:

Documents


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Programming a Shooter

Game Design

Page 2: Www.  Programming a Shooter Game Design

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.

Page 3: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Learning Objectives• 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 WordsVariable ‘Storage box’ used in programming to store dataSprite Programmable objects in ScratchScripts Blocks of programming code in Scratch

Page 4: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Hands up if you know how to program a shooter in Scratch?

Page 5: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

What needs to happen to create a shooter? Planning

1. We need a main character2. 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

Page 6: Www.  Programming a Shooter Game Design

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 pressed1 when the right arrow key is pressed

Page 7: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

1. Use a variable to record which way the main sprite is facing1

2

3

Main

Character!!

Page 8: Www.  Programming a Shooter Game Design

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)

Page 9: Www.  Programming a Shooter Game Design

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)

Page 10: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Demonstration of Shooter

How is this done?

Page 11: Www.  Programming a Shooter Game Design

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.

Page 12: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Hands up if you know how to program a shooter in Scratch?

Page 13: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Write down on your whiteboard, in your own words, how this script works

3 minutes

Page 14: Www.  Programming a Shooter Game Design

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.

Page 15: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Programming Task 1 and 2Open 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.

Page 16: Www.  Programming a Shooter Game Design

www.computerscienceuk.com

Assessment CriteriaLevel Programming 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.