www.computerscienceuk.com programming computer games game design

28
www.computerscienceuk.com Programming Computer Games Game Design

Upload: jeffrey-garrett

Post on 27-Dec-2015

233 views

Category:

Documents


3 download

TRANSCRIPT

www.computerscienceuk.com

Programming Computer Games

Game Design

www.computerscienceuk.com

Starter

Y-axis

X-axis-240 240

180

(0, 0)(x,y)

What is the position of the:

1) Star2) Square3) Triangle4) Rectangle5) Cat

-180

www.computerscienceuk.com

Learning Objectives

• Learning Objectives– Remember the coordinates system in Scratch.– Learn how to program a scrolling background.– Understand how Scrolling Backgrounds work.

• Success CriteriaLevel4/5– To code a scrolling background with support.– To briefly describe how the scrolling background code works.Level6/7– To code a scrolling background mostly from own knowledge.– To explain fully and in detail how the scrolling background code works.

Literacy – Key Words

Sprite A programmable object

Scrolling Background The illusion that the screen is panning / moving across the ground

Coordinates Two numbers to identify the position of an object

www.computerscienceuk.com

Learning Habits / Skills Required

• Independence - Working effectively alone

• Avoid Distractions - and sustain concentration

• Capitalising - Using resources purposefully

• Perseverance - Overcoming frustration and difficulty

• Reasoning – Thinking rigorously, methodically and giving explanations.

www.computerscienceuk.com

Hands up if you remember what the coordinates system

is in Scratch?

www.computerscienceuk.com

Starter

Y-axis

X-axis-240 240

180

(0, 0)(x,y)

What is the position of the:

1) Star (-240,180)2) Square (240, -180)3) Triangle (-240, 0)4) Rectangle (0, -180)5) Cat (0,0)

-180

www.computerscienceuk.com

Hands up if you remember what the coordinates system

is in Scratch?

www.computerscienceuk.com

Project Aim

• You will design and create a computer game…

…but unlike previously we will learn how to program a scrolling

background.…and here is one I made earlier!

www.computerscienceuk.com

Programming Scrolling Backgrounds

www.computerscienceuk.com

Hands up if you know how to program “Scrolling

Backgrounds”?

www.computerscienceuk.com

Scrolling Backgrounds…The Theory

www.computerscienceuk.com

A scrolling background is simply two sprites which move to the left.They are positioned next to each other.

As soon as a sprite goes too far to the left, it is repositioned to the right of the screen.

This gives the illusion of a moving background!

www.computerscienceuk.com

Sprite 1 Sprite 2

www.computerscienceuk.com

E.T.C!

www.computerscienceuk.com

Y-axis

X-axis

Remember the Invisible Coordinates Grid?

(0, 0)(x,y)

How can we move a sprite to the left along the x axis in scratch?

-240 240

180

-180

www.computerscienceuk.com

Which is going to help us move along the x axis?

www.computerscienceuk.com

Scrolling Backgrounds…Programming!

www.computerscienceuk.com

1 2

3

4

5

+

6

Create a new sprite.

Zoom out as far as you can.Paint your

‘ground’ at the bottom of the canvas

So, now go back and edit the same sprite.

At this point scratch will annoyingly centre the sprite…

Choose the ‘Select Tool’ and ‘Zoom Out’ again.

Finally, drag the sprite down to the bottom of the canvas.

www.computerscienceuk.com

Now repeat the process to create the second sprite.

www.computerscienceuk.com

Place first sprite so that it is centred at the bottom of the screen.

Then forever move the sprite to the left (change x by -5).

But, if the position of the sprite goes too far to the left (x pos < -450), move back to the right of the screen (x=450)

Programming The Scrolling Background Sprites

Understanding the Scripts

Block

www.computerscienceuk.com

Place first sprite so that it is to the right of the screen.

Then forever move the sprite to the left (change x by -5).

But, if the position of the sprite goes too far to the left (x pos < -450), move back to the right of the screen (x=450)

Understanding the Scripts

Block

Programming The Scrolling Background Sprites

www.computerscienceuk.com

Hands up if you know how to program “Scrolling

Backgrounds”?

www.computerscienceuk.com

Demonstration

www.computerscienceuk.com

Programming Task 1

’12 Minutes’

Open a new scratch file

Use this presentation to program your own scrolling background

www.computerscienceuk.com

Programming Task 2

’12 Minutes’

Complete the worksheet explaining the code you have created and how the scrolling works.

www.computerscienceuk.com

Assessment CriteriaLevel Programming Skills

7• I can produce the code from my own understanding.• I can explain what the code does in detail and in my own

words.

6• I can produce the code mostly from my own understanding

but use the lesson resources for support.• I can explain what the code does in detail and in my own

words

5• I can use the resources to help me code the scrolling

background• I can describe what the code does in my own words

4• I can copy the code to produce the scrolling background• I struggle to describe how it works in my own words

www.computerscienceuk.com

Learning Habits / Skills Required

• Independence - Working effectively alone

• Avoid Distractions - and sustain concentration

• Capitalising - Using resources purposefully

• Perseverance - Overcoming frustration and difficulty

• Reasoning – Thinking rigorously, methodically and giving explanations.

www.computerscienceuk.com

Programming Task 3

’12 Minutes’

Design / Paint a flying object which you will control in your game (we will program this next lesson)

Design / Paint the ‘stationary’ background to make your game look more interesting.