This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Learn some programming basics [Dec. 16, 2011, 4:16 p.m.]



In order to build your game, you'll need to know a few programming basics. Let's learn about them now. The three things you'll need to know are:

1. How to ask a player for information
2. How to store that information
3. How to write a sentence using the player's information

Let's start with #1: Asking a player for information.

- Open Wing IDE, and in the top-left corner, type the following:

first_name = raw_input("Tell me your name, and click enter. ")

- Find the green "play" arrow. Click it. (This starts your game.)

- In the bottom-right corner, play your game.

There! You just figured out how to ask a player for information. Now, let's figure out how we can store that information. The good news is that we're halfway done. Because you replied with your name, it has been stored as the variable "first_name". You can imagine that we have a jar called "first_name" and your name is inside it. Now, let's figure out how we can tell the computer to tell us what's in the "first_name" jar.

- In the top-left corner of Wing IDE, keep the line you just typed. Click "enter" so that you're on a new line. Type the following:

print first_name

- Click the green "play" arrow again. Play your game in the lower-right corner. Note what happens.

Now, we're on to Step 3: displaying a story us