Home > Articles > Programming > Games

📄 Contents

  1. Getting Started
  2. Adding Details and Instructions
Like this article? We recommend

Adding Details and Instructions

Now that the city is created we’re almost ready to start programming the behavior of the Saucer and the controls to move Kodu. But there are just a couple more items to tend to — dropping some Coins in the city and shrinking down Kodu and Saucer so they can fit between the buildings and move easily on the streets.

First, the Coins. You already know how to add a Kodu or Saucer object, so all you need to do now is drop in three Coins. (You can modify the game later by adding more coins or reducing the number of coins found.)

Select the Object Tool and click on an empty bit of terrain. From the pie menu that appears, click on the pie slice shown in Figure 23. You can see the gold Coin object on it, but you must click on this pie slice to open up another pie slice that contains the Coin.

Figure 23 Time to add some Coins

Do this two more times and you’ll have three Coins sitting near the edge of the city as shown in Figure 24.

Figure 24 Three Coins ready to be hidden in the city

Zoom out and rotate your view until you’re looking straight down again on the city. Change to the Object Tool and left-click and hold a coin so you can drag and drop it somewhere on a street. Do this for the remaining coins — if you look carefully at Figure 25 you can see that I’ve placed three coins at three different intersections.

Figure 25 The Coins are placed between skyscrapers

Now it’s time to shrink down Kodu and Saucer a bit. Rotate and zoom in a bit on the Saucer as shown in Figure 26.

Figure 26 Time to shrink the Saucer

Click on the Object Tool icon and then right-click on the Saucer. A menu will appear like the one in Figure 27.

Figure 27 Right-click an object to view its menu

Click on the Change Size button and then drag the bar to the left until the Saucer shrinks in size. You can see this drag bar in Figure 28.

Figure 28 Use a Drag Bar to resize an object

While I’m working on Saucer, I want to also change Saucer’s distance from the ground. Right-click on the Saucer again and choose the Change Height option. Drag the Drag Bar to the left until Saucer is closer to the ground. Figure 29 shows that I’ve shrunk Saucer and lowered it a bit. I also moved Saucer onto a city street by dragging and dropping it.

Figure 29 Saucer is smaller and closer to the ground

Rotate your terrain and do the same thing with Kodu. Figure 30 shows that I’ve shrunk Kodu so it will easily be able to move down the streets and not get stuck (or blocked) by any skyscraper.

Figure 30 Kodu is also smaller, but he doesn't fly so no height change is needed

Two tasks remain: (1) Program Kodu so player can control movement and weapon firing, and (2) Program Saucer for random movement and firing on player.  Let’s tackle Kodu’s movement first.

Zoom in a bit on Kodu and right-click on it. From the menu that appears, choose the Program menu. A screen will appear like the one in Figure 31.

Figure 31 An object's programming screen

When you first program an object, the programming screen is empty. Notice the WHEN and DO boxes (each with a  + sign) are displayed to the right of a number (a 1 in this instance). Programming an object in Kodu Game Lab is mainly a matter of deciding what type of action to take when something happens:

WHEN [something happens] DO [an action]

In this case, I want Kodu to move when I press certain keys on the keyboard. Traditional computer games use the WASD configuration — the A key turns the player to the left, D turns the player to the right, W moves the player forward, and S moves the player backwards. The WHEN-DO programming might read like this:

WHEN (a WASD key is pressed) DO [move Kodu in the  corresponding direction]

That should work here, so the first thing you’re going to want to do is click on the + in the WHEN box and click on the Keyboard pie slice shown in Figure 32.

Figure 32 Choose the Keyboard option

By selecting Keyboard, you’re specifying you wish Kodu to do something when a keyboard key (or keys) is pressed. You could program Kodu to use a Gamepad, a mouse, or even your finger (if you’re using a tablet with a touchscreen). But for now, choose Keyboard and then click the + to the right of the Keyboard icon shown in Figure 33.

Figure 33 The Keyboard has been added to the WHEN box

After clicking the + to the right of the Keyboard, a new pie menu appears like the one in Figure 34. Click on the WASD pie slice.

Figure 34 Choose WASD to control Kodu's movement

Look back at Figure 34 and you’ll notice there are many more options — you could have used the Arrows option to control Kodu with the Left/Right/Up/Down arrow keys... you could also use the Letters option to specify a single letter button on the keyboard. Fortunately Kodu Game Lab can handle monitoring the WASD keys for you so you won’t have to program each movement (left, right, forward, or back) individually!

Next we need to deal with what to do when the WASD keys are pressed. This is done in the DO box. Click the + sign to the right of the DO box and you’ll see a menu appear like the one in Figure 35.

Figure 35 Time to program the actions for the WASD keys

Remember how I told you you’ll only be using about 5% of the tools and features of Kodu Game Lab? Figure 35 contains even more options for what can occur when the WASD keys are pressed, but in this case our choice is really easy: choose the Move option! Once you’ve clicked on the Move option, Kodu’s programming screen should look like the one in Figure 36.

Figure 36 Kodu's movement programming is complete

Tap the ESC key (Escape) key on your keyboard to return to the game. It’s time to test out Kodu’s movement! Press the Play button (it’s the triangle to the right of the House icon on the toolbar) and take Kodu for a spin. Use the WASD keys to drive him around on the screen. Figure 37 shows me driving him down one of the safe city streets. Safe for now...

Figure 37 Taking Kodu for a drive

Now let’s focus on the Saucer. Rotate and zoom in on the saucer and then right-click on it. Choose the Program option (like you did for Kodu) and you’ll once again see a blank programming screen. Time to change that.

Because Saucer will be roaming on its own (with no human controlling it), there’s no need to program the WHEN box. If the WHEN box is left empty, it’s the same as saying ALWAYS- DO [something]. What do we want Saucer to do? Roam randomly.

So, to do this, click on the + sign to the right of the DO box and choose the Move option. Saucer’s programming screen will look like the one in Figure 38.

Figure 38 Saucer is programmed to just... move

If you press the Play button and watch, you’ll see that Saucer moves quite randomly around the city (even off and away from it at times), and at very high speeds. Let’s modify that a bit. Click on the + sign again to the right of the Move option and choose the Slowly option. Press Play and notice the speed difference. You can even click the + sign again and add another Slowly option if you like!

Next you’re going to program Saucer to fire on Kodu if it sees Kodu. To do this involves adding another WHEN-DO line of programming. So, right-click on Saucer, choose Program, and open up the programming screen again. You’ll notice that after you created some programming for the first line, a new line is automatically added (and numbered 2, of course). Click on the + sign next on the WHEN box and choose the See option. The See option will be added, but you still need to specify what you wish Saucer to be looking for... Kodu! So, click on the + sign to the right of the See option and choose… Kodu! Your second line of programming should look like the one in Figure 39.

Figure 39 Saucer is programmed to be on the lookout for Kodu

What does the Saucer need to do when it sees Kodu? Fire a missile, obviously. So, click on the + sign for the DO box and choose Shoot. But shoot what? Click the + sign to the right of the Shoot option and choose the Missile option. Now the second line of programming looks like the one in Figure 40.

Play the game and notice what happens – Saucer immediately fires a missile followed by a BUNCH of missiles. Is the game cheating? Not really. What’s happening is that the buildings haven’t really been programmed as real visual obstructions to Saucer. Saucer can see everywhere, so it fires missiles immediately. What’s needed is to specify Line-of-Sight firing. This means that Saucer will only fire when it can see Kodu directly... if something is blocking Saucer’s sight to Kodu, it won’t fire a missile. To do this, you’ll need to modify the firing program a bit.

Go back to the WHEN box and click the + sign to the right of the Kodu option and choose the Options pie slice shown in Figure 40.

Figure 40 Fine-tuning the programming requires the Options pie slice

After clicking on Options, you’ll see another pie menu like the one in Figure 41 – click on the LOS (Line of Sight) option and it’s added to the program.

Figure 41 Choose LOS option

Play the game again and you’ll notice this time that Saucer only fires when it can see Kodu directly. That problem is fixed, but there’s another one — the missile can fly over the buildings! If the player tries to run from a missile, the missile will fly up and over and around a building to hit the player. That’s not good. To change that, let’s modify the programming for the missile. Click on the + sign after the Missile option and you’ll see a pie menu like the one in Figure 42.

Figure 42 Modify the missile so it flies straight and level

From the new pie menu, choose the Level option. Figure 43 shows the newly modified Saucer program that contains the LOS and Level options that make the game a little more fair.

Figure 43 Saucer's new program

After testing the game, I’ve found a few more changes that should be made. First, a single missile from Saucer will destroy Kodu. I want to modify that so it takes four missile hits to destroy Kodu. To do this, I’m going to modify how much damage the missile can do, AND I’m going to modify Kodu’s health.

First, I right-click on Kodu — from the pop-up menu, choose Change Settings. A scrolling list of options appears like the one in Figure 44.

Figure 44 Each object can be fine-tuned with the Settings list

Use the mouse scroll wheel or the Up/Down arrow keys to move down the list until you reach the Max Hit Points option. Drag the bar to the right to give Kodu 100 health points as seen in Figure 45.

Figure 45 Increase Kodu's health points

Tap the ESC key and right-click on Saucer and choose Change Settings. A similar scrolling list will appear, but this time I want you to find the Missile Damage drag bar shown in Figure 46. Drag it to the left and set it to a value of 25. (It will take four missile hits to destroy Kodu – 25 damage/missile x 4 missiles = 100 health points.)

Figure 46 Decrease the damage value done by each missile

Tap the ESC key to leave the Settings list.

The game is almost done, but there are two small tweaks to make that will make the game more enjoyable for your player: (1) Change the POV (point of view) so the player sees everything from Kodu’s perspective... it will feel like you’re actually walking/gliding down the city streets, and (2) End the game if the player finds a coin.

To change the POV, open Kodu’s programming screen again and click the + sign to the right of the DO box on line number 2. Select the View option from the pie menu that appears and then click on the 1st Person option. Kodu’s new programming screen should look like the one in Figure 47.

Figure 47 The player will now see through Kodu's eyes

Test the game and go hunting for a coin. Figure 48 shows what a coin will look like on the streets from Kodu’s perspective.

Figure 48 1st Person View of the city streets

All that’s left is to add programming to end the game when a coin is picked up. Once again, open up Kodu’s programming screen and click on the + sign to the right of the WHEN box. Choose the Bump option. Next, click the + sign to the right of the Bump option and choose the Coin option from the Objects pie slice. You’re programming screen should look like the one in Figure 49 at this point.

Figure 49 Programming Kodu to test for bumping a coin

What happens when Kodu bumps a coin? The game should end! So, click the + sign to the right of the DO box and click on the Game pie slice shown in Figure 50.

Figure 50 This slice contains options for ending the game

A new pie menu appears. Click on the Win option. Kodu’s final programming screen should look like the one in Figure 51.

Figure 51 The game will end (player wins) if a Coin is bumped

Play the game! Find a coin and you should get a screen like the one seen in Figure 52.

Figure 52 Player Wins!

Congratulations! You’ve just programmed a simple one-player game with Kodu Game Lab... and hopefully in 60 minutes or less.

As you can see, Kodu Game Lab is easy to use — most everything is done with the mouse during the actual programming of a game: select, drag, move, scroll, etc. And it’s all visual and very fun to use.

What’s great about Kodu Game Lab is that it’s so easy to experiment with any game you create. You can design two-player games or up to six-player games. You can add scoreboards. You can have objects speak to you (on screen with text). You can program Power Ups. And so much more.

What could you do to upgrade Skyscraper Panic, for example? Well, here are some ideas:

  1. After Kodu collects two Coins, Kodu gets missiles to fire back.
  2. Program the Coins to wander around or even run from Kodu!
  3. Add another Saucer to make the game more difficult.
  4. Increase the size of the city.
  5. Place hazards (like water or pits) that will damage Kodu when touched.
  6. Add a countdown timer that ends the game — Saucer wins if no coins are collected.
  7. Add a Power Up that briefly turns Kodu invisible to the Saucer.
  8. Limit where Saucer may roam — provide a safe area to take a rest.
  9. Change from 1st Person View to Bird’s-eye (looking down from above).
  10. Increase the Saucer’s movement speed but decrease its missile speed.

As you can see, there’s a lot you can do with this simple game, but hopefully you’ve got some ideas for games of your own. You’ll be happy to know that games created in Kodu Game Lab can be shared with your friends... or the entire world. You can get feedback from your games from others and improve them or make changes based on suggestions.

The key is to have fun... and programming with Kodu Game Lab is fun! Good luck!

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020