Вы находитесь на странице: 1из 21

# Game Development Using Kodu

## Kodu Student Guide

Student Packet Contents

Lesson 1
Introduction and Kodu Tutorials ......................................... 3

Lesson 2
Scoring and Walls .............................................................. 7

Lesson 3
Landscapes and Problem Solving...................................... 9

Lesson 4
Paths and Behaviors .......................................................... 13

Lesson 5
Health, Timers, and Creatables ......................................... 17

P a g e |1
This packet is to be used with the Kodu Unit created by Jim Alleman. Resources and
files can be found by visiting the website listed below.

http://www.wix.com/jimedallemaniii/home

All files mentioned in the packet are included in the KoduUnit.zip folder. Instructions
for saving files is intended for McNeil High school and may not work at other
institutions. Please instruct students on proper saving procedures.

## Created By Jim Alleman.

P a g e |2
Lesson 1 Walkthrough
In this lesson you will walkthrough the first three tutorials and complete the exercises
listed for each tutorial. After this lesson you will be able to:
add a Kodu to your world and change the color of the Kodu.
understand the concept of a condition (WHEN) and an action (DO).
program the Kodu to respond to user input using the arrow keys on the keyboard.
add apples to the world and change the color of the apples.
program the Kodu to find and eat specified apples.

First Tutorial
Launch Kodu and select Load World.
Click on the First Tutorial and select play.
Walkthrough the first tutorial.
When the screen says
Congratulations! click on
continue and finish the
activities listed below.

## 1. Change the color of

Kodu. Make sure you are in edit mode (hit Esc) click on the Object tool and
put your mouse over Kodu. Leave your mouse over Kodu and use the arrow keys to
select a new color.

2. Adding a second condition to Kodu. Make sure you are edit mode and right-
click on Kodu and select program. Add the following condition:
WHEN: keyboard ~ letters / J | Do: actions / jump

3. Modifying the Move and Jump actions. Kodu initially moves slowly. We can
change how quickly he moves and how high or low he jumps. Simply get to the program
screen, and click on the plus sign to the right of the move tile to select quickly. Click on
the plus to the right of jump and select one of the tiles. Play the program. Exit the
world and do not save.

P a g e |3
Programming Kodu to Find Apples Tutorial
Click on the house to exit to the main menu and select Load World (you do not have to
save any work). Find the second tutorial Programming Kodu to Find Apples Tutorial
and play the tutorial.
After you complete the tutorial click on continue and complete the activities below.
1. Change the color of the apple. Change the color of one of the apples to green.
2. Change Kodus Height. Kodu looks funny higher than the apples. To change
Kodus height click on the object tool and then right click on Kodu and change the height
to the lowest value you can get (anything under 1). Now Kodu is on the ground level.
3. Program Kodu to only eat red apples. Make sure you have the object tool
selected. To modify existing tiles simply click on the tile and then you will be given more
choices. Click on the apple tile and change it to colors + red. Click on the plus sign on
the right of the red tile and add objects + apple. Now your program list should look like:

## What happens if Kodu bumps into the green apple?

4. Program Kodu to do something when it does not see any red apples. After
Kodu has eaten all the red apples we can program him to do something else when he
does not see any red apples by using the not tile.

Play the world and when finished, exit and do not save.

Click on the house to exit to the main menu and select Load World (you do not have to
save the previous work). Find the third tutorial Add Paint/Terrain Tutorial and play
the tutorial.
This tutorial only shows you how to add terrain and change brush types and sizes. We
will explore landscaping in future lessons. Exit and do not save.

P a g e |4
Lesson 1 Activity. Creating Your Own World
Once you have completed the first three tutorials you are ready to create your own world
with a simple animation sequence. Click on the Home Menu button and select New
Empty World.

## Use the camera tool to

world as you would like to
Camera Tool
see it during program
execution (use right click to move, left click to orbit camera, and scroll to zoom in and
out)

1 Red Kodu and change the height to ground level
10 red apples
10 green apples
Animate the world by having Kodu eat all of the red apples and jump when it bumps
into a green apple.

Game Activity
Add a second Kodu (on the ground level) and change the color to green. Program the
Kodu so you can control it and have it eat the green apples and jump when it bumps into
any red apples.

Can you eat the apples faster than the other Kodu?

Program the red Kodu to create more green apples when it bumps into the green Kodu
and have the green Kodu create red apples when they bump.

Save the file as Apple Race v 00 and then exit to the main menu. Select
Load World and click on Apple Race and export it to your H drive. From the Load
World Menu click on Apple Race and select delete.

P a g e |5
Getting to know the Objects

Kodu has many objects that we can use in creating a world. In this short activity you
will get a chance to explore objects provided by Kodu.

1. Create a new empty world. Click on the object tool to add a new object to the
world. Click where you want the new object to appear then select the
tile with the saucer, cycle, and flying fish (see picture to the right).

## 3. Getting descriptions. Position your mouse pointer over the

balloon and a pop up describing the balloon will appear. To see the
example you hit the Y key on the keyboard.

of the objects.

## 4. Program an object. Pick one

of the objects and program it to
move with the arrow keys and feel
how it behaves.

## 5. Other objects. Browse

through some of the other
categories and see what objects
are available and try them out.

## When finished exit and do

not save.

P a g e |6
Lesson 2 Walkthrough
In this lesson you will walkthrough two more tutorials, and complete the exercises listed
for each tutorial. After this lesson you will be able to:
end the game based on a terminal score.
program artificial intelligence for a computer controlled opponent.
enable glass walls so characters and objects do not fall off your world.
change the color of the sky.

Score Tutorial
Launch Kodu and select Load World. Click on
Score Tutorial and select Play.

## After you complete the tutorial click on continue

then hit the esc key and complete the activities
below.

1. Adding Green Apples. Add two green apples in the path of the cycle. Program the
cycle to subtract points if it eats a green apple. Play the program.

2. Add More Apples. Add 10 more red apples, three green apples and increase the
points needed to end the game to 10.
3. Add a Wandering Kodu. Add a Kodu and program it to wander around the world.
Program the cycle to avoid the wandering Kodu, when the Kodu is close (the sequence
below is for the cycle).

## What is the behavior of the cycle?

4. Change Program Order. Find the WHENDO sequence that has the cycle
avoid the Kodu and click on the number of the sequence and drag it up to be the first
sequence in the program for the cycle.
Does this change the behavior?
Navigate back to the home menu and discard changes. Do not save changes.

## Glass Walls Tutorial

Select Load World and find the Glass Walls Tutorial. Walkthrough the four steps of
the tutorial. Navigate back to the Home Menu. Do not save any changes.

P a g e |7
Lesson 2 Activity. Creating Your First Game

Find apple race on your H drive and double click on it to open it in Kodu.

## Complete the game by adding the following components:

score for the red Kodu
score for the green Kodu
play the game until one of them reaches 15
change the color of the sky to your preference

Play the game. How can you make the game easier? How can you make it harder?

## Modify your game to have the following elements:

add another color apple that has an effect on the Kodus
add another rock or tree and program it to launch more apples
increase the score to win
add another object that might cause a Kodu to lose points
modify the artificial intelligence on the red Kodu

Add anything you can think of to make the game fun and interesting to play.

## Save the game as Apple Race v 01 and export it to your H drive.

After exporting do not forget to delete the game from the Load World menu.

P a g e |8
Lesson 3 Walkthrough
Creating landscapes in Kodu can be a challenge and practice is important. In this lesson
you will use an existing world to create landscaping. After this lesson you will be able to:
create and modify landscapes.
create a title screen.
debug and create logical solutions.

Landscaping
Launch Kodu and select Load World. Navigate to New World in the list of worlds.
The New World is a rather small and empty world ready to be created.
Zoom out so you can see more of the world. The use of the landscaping tools are quite
simple but may need a little practice to get used to them. Explore each one of the tools in
the empty world.

The Up/Down tool can be used to create hills and valleys. Left click
creates hills and the right click creates valleys. This tool comes
with the following brushes: square brush, round hard brush,
medium round brush, soft round brush, mottled brush, and the
magic brush.
The flatten tool can be used to flatten hilly areas
and make the terrain look less rough. Right click
Up/Down Tool smoothes and left click flattens out the terrain.
This tool has only three brushes: square, round,
and magic.

## The roughen tool makes the landscape rougher. Flatten Tool

Left click makes it spiky and right click hilly. This
tool only has three brushes as well.

raises the water level and right click lowers the
Roughen Tool water level. You can change the color of the water
by clicking on the color palette.

Knowing how to use the different tools can allow you create a
landscape quickly and rather easily. Water Tool

Exit Kodu. Do not save any changes unless you want to keep it for later.
Navigate to the lesson 3 folder and launch Landscape, by JA.Kodu.

P a g e |9
Painting Terrain
In the second lesson you may have noticed how to paint terrain using different brushes.
When creating terrain and landscapes it might help to view your world looking straight
down.
1. Launch Landscape. If you have not launched Landscape, by JA.Kodu then
navigate to your lesson 3 folder and launch the file.

## 2. Linear Square Brush. The linear square brush can be quite

useful to make landscape and paint terrain with lines. Hit the esc key
to get to edit mode and select the paint terrain icon. Make sure you are
using terrain 20 and then select the linear square brush. Find the
upper right corner of the world and click once and drag down to the
bottom right corner and when you are happy with the line let up the Linear Square Brush
right click.
3. Magic brush. The magic brush
allows you to change one terrain to
another one very quickly. We are
going to raise the red square to
make it like a wall. Click on the
Up/Down tool and then select the
magic brush from the brushes.
With the magic brush put your
mouse pointer over and part of the
red square and right click to raise the
red area like a wall. If it is too high left
click to lower the terrain.

## It might help to rotate the camera so

you can get a better angle. I prefer to
look straight down on my world when I
am selecting things with the magic
brush.
4. Fill with Water. Click on the water tool and fill the red
square with water. If the water fills up and covers the entire
world do not panic. Remember left click will cause the water
to go down.

P a g e | 10
5. Raising all the terrain. The magic brush is great to create a large and thick terrain.
We are going to raise all of the green terrain and then go back and raise the red terrain
and water. Select the magic brush and click anywhere on the green and the whole green
area will rise up.

## 6. Raise the red Walls.

Using the magic brush
raise the red walls (you
camera to see the red
walls).

## 7. Raise the water level.

This might be tricky. If you
raise it too high lower it
and try again.

## 8. Create another wall.

To make a wall you need to
make the brush small to
make the wall narrow. Pick a different terrain and using the linear square brush create a
line and then use the up/down tools magic brush to raise just the wall.

9. Adjust the landscape. Be creative and add some hills and valleys and maybe some
more water to the world.

Save your world with a new version number and export it to your network
drive. Delete the world from the Load World list.

P a g e | 11
Changing World Settings
Open Apple Race from your network drive. Click on the Change World Settings
icon. Scroll down and look for Start Game With and select World
Description. In order for the game to list the description you need to have
added a description in the saving process.

start up.

After you have played your game click on the Change World Settings tool and choose
Description with Countdown.

## Add some small hills, and valleys to Apple Race.

Save your world with a new version number and export it to your network
drive. Delete the world from the Load World list.

Lesson 3 Problems
Exit Kodu and navigate to the Lesson Files folder in the Kodu folder you copied to
your network folder. Open the Lesson 3 folder.

1. Double click on Blue Rock to launch it. Program Kodu to move toward the blue rock
but do not let Kodu bump into the rock. Save the solution and export it to the original
folder replacing the old one. Delete it from the Load World list.

2. Launch Apple Hunt and program Kodu to navigate around the rocks. Save the
solution and export it to the original folder replacing the old one. Delete it from the

3. Launch Apple Hill and program Kodu to not be able to see through the hill. Save the
solution and export it to the original folder replacing the old one. Delete it from the

P a g e | 12
Lesson 4 Walkthrough
In this lesson you will launch a world and walkthrough the following steps. After this
lesson you will be able to:
create paths for objects to follow.
change behaviors using pages.
modify the view of the camera.

Navigate to the Kodu folder and find the Lesson 4 folder. Open the folder and double
click the Lesson 4, by JA.kodu file.

Paths
The purpose of a path is to allow objects in a game to follow a predetermined route.
Once Lesson 4, by JA.kodu file is opened click on the path tool.

1. Create a spot. Click on the yellow trail and you will notice the path
tool created a spot.
Path Tool
2. Create the path. Move up the path and
click again and you will notice a line between
each spot. Continue creating a path around the
yellow trail. When you complete the path back
to the original spot hit the esc key.

## Completed Path is show on the

right.

P a g e | 13
3. Programming the saucer to move along the path. Click on the object tool and
right click on the saucer. Select program and add the following (the always tile is located
in the more category).

4. Changing the color of the path. Click on the path tool and put the mouse pointer
on one of the spots of the path and the color picker will appear. Using the arrow keys
arrow over to red and then change the saucers program to:

A program that uses multiple paths should use multiple path colors for each object to let
them know which path to follow.

Using Pages
Behaviors of an object can change as the game or story progresses. We will be using
pages to change the behavior of the cycle.
1. Switch Pages. Select the object tool and right-click on the cycle and select program.
Currently, the cycle is programmed to move in response to the arrow keys. On the
WHEN ~ bump ~ saucer | DO ~switch ~ page2

Adding code to page 2. To navigate to page two, simply click on at the top of

## the page. The will take you back one page.

P a g e | 14
2. Program Page 2. Program page 2 with the following tiles: (space is under misc
category)

3. Go Back a Page. Play the game and observe the behaviors or the cycle. Can the
cycle shoot before bumping into the saucer? What happens when you shoot the rock or
the tree? Program the cycle to return to page 1 after he shoots the saucer using the shot
hit tile. Now the cycle will be able to shoot when he bumps into the saucer and if he
shoots the saucer the cycle will no longer have the ability to shoot.

4. Changing the Camera View. We are going to change the camera view by bumping
into the rock and then changing the camera view back when bumping into the tree. To
change the camera view program line three of the cycle to:
WHEN ~ bump ~ rock | DO ~ view / 1st Person
Then program line four to:
WHEN ~ bump ~ tree | DO ~ view / follow

Play the world. What happens when you bump into the saucer then bump into the rock
before shooting the saucer?

## Save your world and export it. Do not forget to

P a g e | 15
Lesson 4 Activity.
1. Create a new World and add three objects that will follow a path.
You can also add other objects like apples or coins for the cycle to eat.

## 2. Create a path for each of the objects to follow.

3. Add a cycle and program it to move using the arrow keys on the keyboard.

4. Have the cycle change behaviors as it bumps into each of the objects (camera view,
ability to jump or shoot, etc.).

5. Add anything you can think of to make the game fun and interesting to play.

## Save the game as Cycle Bump v 00 and export it to your H drive.

After exporting do not forget to delete the game from the Load World menu.

P a g e | 16
Lesson 5 Walkthrough
In this lesson you will use an existing world to modify health and add timers to game
play. After this lesson you will be able to:
use health and a health meter for a character.
use a timer during game execution.
create clones and creatables.

Navigate to the Kodu folder and find the Lesson 5 folder, open it and double click the
Lesson 5 v00, by JA.kodu file.

Health Meter
1. Turn health meter on. Find the green Kodu and click on the Object Tool. Then
right click on the green Kodu. From the menu select Change Settings. Scroll through
the settings and find Show Hit Points and hit enter to turn the setting on (Notice you
can modify the maximum amount of hit points a character can have below Show Hit
Points.)

Off On

2. Health of others. Display the health meter for the dark Kodu as well.
Notice the health meter appears above the character.

Creatables
Creatables are objects that can be created by characters during game play. We will be
creating a ball so the two characters can play a simple game of dodgeball.

1. Creating the Ball. Select the Object Tool and click anywhere to the right of the
green Kodu and add a ball to the world. Right-click on the ball and change the size of the
ball to size 0.2

2. Making the Ball a Creatable. Right-click on the Ball and select Settings and
scroll to find Creatable and turn the setting on. Play the game.

What happened to the ball? Objects that are set to Creatable will be generated by
other characters and will display when they are created. Outside of the game you can
program the object just like any other object in the world.

P a g e | 17
3. Programming the Ball. We need to make sure the ball does damage and then
disappears after it is used. Program the ball with the following:
Line 1: WHEN ~ bump ~ kodu | DO ~ combat / damage ~ 10 Point ~ it
Line 2: WHEN ~ bump ~ kodu | DO ~ combat / boom ~ me

4. Program the green Kodu. We will program the green Kodu to launch a ball
toward its opponent. Program line 2 with the following:
WHEN ~ keyboard ~ misc/ space | DO ~ actions/launch ~ creatables / ball1 ~low ~once

## Play the game.

5. Program the other Kodu. The other Kodu will be the computer controlled
nemesis of the green Kodu. Program his by adding the following lines:
WHEN ~ see ~ kodu | DO ~ actions/launch ~ creatables/ball1 ~ low

## Play the Game. What is wrong? How can we fix it?

6. Launch Once. Modify line 1 so the Kodu Lanches once.

## Play the game. What is wrong now?

P a g e | 18
7. Use pages to control launches. We can control the frequency of the launches by
using a timer and switching pages. Add the following line to the dark Kodu:
WHEN ~ timer ~ 2 seconds | DO ~ switch ~ page 2

8. Program Page 2. On page 2 we will program the character to move toward the
other Kodu, launch a ball, and then switch back to page 1. You can change the timer to
make this action happen faster or slower. Program page 2 with the following lines:

## Before you try

move the dark
Kodu far from
the green Kodu.

Play the Game. Notice that any ball can cause damage to the Kodu and the balls never
leave the game. We can program the balls to vanish after 3 seconds of the launch.
9. Program the Ball. We will program the ball to vanish after 3 seconds of being
launched. Add the following line to the balls program:

You can add some rocks and other obstacles to hide behind before you play the game.
Does the other Kodu still launch a ball when he cannot see you? Save if you would like
to keep a copy otherwise exit and do not save.
P a g e | 19
Lesson 5 Activity.
The game is far from perfect and complete. Add the following features to the game to
make the game a little better.

1. Modify the existing ball1 to be green. Create another creatable ball (black) that is
launched from the black Kodu. Modify the code so the green balls do not harm the green
Kodu and the black balls do not harm the black Kodu.

2. Add a scoring component. One point for each time a ball hits an opponent. Add a
score that will cause the game to end.

3. Add apples, stars, or coins to increase health of the Kodus. Do not forget to program
the other Kodu to move to them when their health is low (You may also change the
starting health points higher than fifty or change the damage to a lower value).

4. Increase the size of the world and add landscaping elements to make the game look
interesting.

Add anything that you might think will make the game better.

## Save the game as DodgeBall v 00 and export it to your H drive.

After exporting do not forget to delete the game from the Load World menu.

P a g e | 20