lesson plan #5 programming for games (a) - bafta...

4
www.bafta.org/ygd Enter the competition at: Schools materials created with support from Lesson plan #5 LEARNING OBJECTIVES All video games are made of computer programmes, consisting of computer code. \ Computer programmes are a series of instructions for the computer to carry out. \ Certain subjects are fundamental to games programming, such as maths, physics and art. \ KEY VOCABULARY programmer | code | programme | developer | development environment OBSTACLES TO LEARNING Computer code may seem intimidating. Emphasise that students are not expected to understand all of the code snippets, but they should be able to work out what parts of them mean. SUGGESTIONS FOR STARTER/STIMULUS Computer programming is a set of instructions for a computer to carry out. Discuss what sorts of tasks a computer might need to carry out to get a game to work. For example, redrawing the screen (parts of the screen or the whole screen), waiting for buttons to be pressed, calculating how an object will move. Show students examples of video game source code. This Wikipedia page lists commercial video games with freely-available source code: http://en.wikipedia.org/wiki/Category:Commercial_video_games_with_freely_available_source_code Choose a game, carry out an Internet search for its free source code and find a site to download the code. Code files open in Notepad or Wordpad. You could ask students to carry out their own internet search. View the interviews about programming with games professionals Toby Moore and Ed Webb on the competition website: http://ygd.bafta.org/top-tips-for-entry/learn-from-the-experts LEARNING ACTIVITIES DEVELOPER ENVIRONMENT The worksheet shows a screenshot of what a programmer sees when developing a mobile phone app. This is an example of a development environment - a computer application that allows programmers to write and test their code. In this case, the development environment is Microsoft Visual Studio. Below the screenshots are captions for students to match with the labels on the screenshot. MATCH THE CODE TO THE INSTRUCTION Print the next two pages on heavy paper or card and cut along the lines to make cards. Then ask students to pair the computer code with the description of what it does. PLENARY SUGGESTIONS Discuss some of the tasks that different types of game programmers have to tackle. The descriptions on the Young Game Designers website is a good starting point: http://ygd.bafta.org/working-in-the-games-industry/industry-overview There would be no video games without programmers. They are the people who take the ideas of the game designers and turn them into (virtual) reality. This lesson shows the students some examples of computer code from a working programme to demonstrate some of the simple building blocks that computer programmes are built from. PROGRAMMING FOR GAMES (A)

Upload: nguyenhanh

Post on 06-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

www.bafta.org/ygdEnter the competition at:

Schools materials created with support from

Lesson plan #5

LEarning ObjEctivESall video games are made of computer programmes, consisting of computer code. \computer programmes are a series of instructions for the computer to carry out. \certain subjects are fundamental to games programming, such as maths, physics and art. \

kEy vOcabuLaryprogrammer | code | programme | developer | development environment

ObStacLES tO LEarningcomputer code may seem intimidating. Emphasise that students are not expected to understand all of the code snippets, but they should be able to work out what parts of them mean.

SuggEStiOnS fOr StartEr/StimuLuScomputer programming is a set of instructions for a computer to carry out. Discuss what sorts of tasks a computer might need to carry out to get a game to work. for example, redrawing the screen (parts of the screen or the whole screen), waiting for buttons to be pressed, calculating how an object will move.Show students examples of video game source code. this Wikipedia page lists commercial video games with freely-available source code:http://en.wikipedia.org/wiki/category:commercial_video_games_with_freely_available_source_codechoose a game, carry out an internet search for its free source code and find a site to download the code. code files open in notepad or Wordpad. you could ask students to carry out their own internet search.view the interviews about programming with games professionals toby moore and Ed Webb on the competition website: http://ygd.bafta.org/top-tips-for-entry/learn-from-the-experts

LEarning activitiESDeveloper environment

the worksheet shows a screenshot of what a programmer sees when developing a mobile phone app. this is an example of a development environment - a computer application that allows programmers to write and test their code. in this case, the development environment is microsoft visual Studio. below the screenshots are captions for students to match with the labels on the screenshot.

match the coDe to the instruction

Print the next two pages on heavy paper or card and cut along the lines to make cards. then ask students to pair the computer code with the description of what it does.

PLEnary SuggEStiOnSDiscuss some of the tasks that different types of game programmers have to tackle. the descriptions on the young game Designers website is a good starting point:http://ygd.bafta.org/working-in-the-games-industry/industry-overview

there would be no video games without programmers. they are the people who take the ideas of the game designers and turn them into (virtual) reality. this lesson shows the students some examples of computer code from a working programme to demonstrate some of the simple building blocks that computer programmes are built from.

PrOgramming fOr gamES (a)

www.bafta.org/ygdEnter the competition at:

Lesson plan #5

PrOgramming fOr gamES (a)

private void txtblk_ManipulationStarted( object sender, ManipulationStartedEventArgs e) { this.NavigationService.Navigate(new Uri("/breath-timer.xaml", UriKind.Relative)); e.Complete(); e.Handled = true;

}

Go to a new page called breath-timer.xaml

set IsTimingBreath to true

change the text of text box infotxt to "touch to start"

make text box infotxt visible

make text box infotxt invisible

set startTime to the current time and date

fill rectange fillRect with bright blue

IsTimingBreath = true;

infotxt.Text = "touch to start";

infotxt.Visibility = Visibility.Visible;

infotxt.Visibility = Visibility.Collapsed;

startTime = DateTime.Now;

fillRect.Fill = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255));

www.bafta.org/ygdEnter the competition at:

Lesson plan #5

PrOgramming fOr gamES (a)

double posY = e.DeltaManipulation.Translation.Y + e.ManipulationOrigin.Y;

set double precision number posY to e.DeltaManipulation.Translation.Y plus e.ManipulationOrigin.Y

if (e.DeltaManipulation.Translation.Y > 0) { breathDir = 0; } else {

breathDir = 1; }

if e.DeltaManipulation.Translation.Y is greater than 0, set breathDir to 0, otherwise set breathDirto 1

fillRect.Fill = new LinearGradientBrush(gradyStopC, angle1);

fill rectange fillRect with a linear gradient described by gradyStopC and angle1

angle1 = 90; set angle1 to 90 degrees

tmr.Interval = TimeSpan.FromMinutes(1); set timer tmr to go off every minute

if (tmr.IsEnabled) { tmr.Stop(); }

if timer tmr is running, stop timer tmr

tmr.Start(); start timer tmr

www.bafta.org/ygdEnter the competition at:

Schools materials created with support from

PrOgramming fOr gamES (a)Student sheet #5

www.bafta.org/ygdEnter the competition at:

Developer environment

this is a screenshot from the development of a real mobile phone app. When the screenshot was taken, the programme was being tested.can you identify the different parts of the screen - a, b c and D - using the descriptions below?

mobile Phone Emulator: \ this is basically a mobile phone running on a computer. the programmer can test their programme on this to see how it works without having to install the programme on a real mobile phone.

text Editor: \ the most important part. this is where the programmer writes the code.

Preview Window: \ this gives a preview of what the mobile phone screen will look like when the programme is running.

Debugging information: \ most programmes don’t work perfectly every time. mistakes in programmes are called bugs, and they are often difficult to find. running a programme to try and find the bugs is called debugging. When the programme is run in debugging mode, information about what is going on in the programme is shown here.

match the coDe to the instruction

you teacher will give you a set of cards with snippets of code taken from a working Windows 7 Phone app. match the computer code to its instruction. this computer language is c#.note: Don’t worry if you don’t understanding everything.

a

b

c

D