Computer Programming I :: Projects :: Adventure Game
Department Connection: Business
Problem
You are going to create a simple game where you make choices about where to go next. Along the way there will be items you can pick up that you will need later on. This project will be completed with a partner and the two of you will take turns coding and evaluating the code.
Create a flowchart for the game that includes what will happen in each area. Things you should include in each segment of the flowchart are what items are found, what the image looks like, what buttons are visible, and the text of the buttons. Click on the flowchart below from one of the original text-based adventure games, Zork, for an example. Note that the Zork flowchart only includes the items and paths. You will also have to include a description of the area and the buttons.

You must be able to go to at least 5 different areas using ifs and else ifs.
You must include an item that can be picked up and used at a later point. You will need to include an if statement inside another if statement to do this, which is called a nested if statement. Look at the example code below to see how this is done.
if (btnChoice1.Text == "Fight The Boss") { if (sword == true) btnChoice1.Text = "Use The Sword"; else btnChoice1.Text = "Use Your Fists"; }
Use and (&&) or or (||) in some of your if statements. You could do this by having multiple items you can pick up and then combining them like the example below.
if ((sword == true && shield == true) || fireRod == true) { btnChoice2.Visible = true; btnChoice2.Text = "Deflect The Attack"; }
Specific Requirements
- Have an image that changes every time you go to a new area. You can change an image in the following way: picName.Image = Properties.Resources.image where image is the name you gave the image when you added it to your project and picName is the name of your PictureBox.
- All of your code should be in a series of buttons that appear and disappear using the Visible property as they are needed. Use btnName.Visible = true to make a button visible and btnName.Visible = false to make a button invisible.
- There should be at least two items you can pick up along the way that use boolean variables.
- There should be at least 5 different areas you can visit.
- The end of your game (whether it is a game over or a victory) should have two options: "Try Again" or "Quit." Try Again should reset the game using Application.Restart() while Quit should close the Form using the code this.Close() or Application.Exit().
- Create a trailer for your game to present the day before the game is due. The class will vote on the most interesting game based on the trailers. You can use OBS Studio or a similar program to record gameplay footage. You can also take screenshots by pressing Windows+PrtScn to save the current screen to a file. There are plenty of free online options for putting the video together. Do a Google search and see what you like.
- Determine a good name for each variable following the rules.
- In your comment header, instead of an algorithm include both names of your group members and how much time each person worked on each day of the project. If one person is absent for a day, that time should be made up the next day.
- Rename the form and all controls on the form.
- Add color, font styles, and at least one picture to make your program look nice.
- Your code should be commented, and your comments and code will be evaluated by your classmates. Make a copy of this Google Sheet to use for other groups to evaluate your game.
Tips
- The text of the button when you click on it should determine what happens next. Plan carefully on paper first to make it easier.
- Double-click on Properties in the Solution Explorer and click on Resources to add images. You then need to click on the arrow next to Add Resource and select Add Existing File... to add your image.
- Play your game a few times to make sure there are no bugs.
- Carefully look for typos if a conditional statement is not working the way you expect it to.