Lesson 06.1 – Creating the remaining classes

Lesson Objectives

At the end of this lesson, you will know…

  • Nothing new. However, you do need to create the rest of the classes, so you can eventually play the game.


Time to add more classes

Now we can create the rest of the classes you’ll use in the game.

By the way, some programmers would call these classes the “business classes”, or “business objects”. Even though this is a game, and not a business application, that’s a term you might hear.


Step 1: Start Visual Studio Express 2013 for Desktop, and open the solution.


Step 2: Right-click on the “Engine” project, in Solution Explorer, then select “Add”, and then “Class”.

Enter the name of the new class to create, and add the properties in the class – just like you did with the Player class.

Copy the code below, to ensure the spelling and casing if the classes and properties is correct. That will be important when we start using the classes – because C# is case-sensitive.

It may not be obvious what all the properties will be used for, but I’ll discuss them when we use them in the future lessons.















There wasn’t really anything new in this lesson. We just need to add these classes to make the game actually do something.


Source code for this lesson

Source code on GitHub

Source code on DropBox


Next Lesson: Lesson 07.1 – Inheritance and base classes

Previous lesson:  Lesson 05.1 – Creating objects from classes

All lessons: Learn C# by Building a Simple RPG Index

17 thoughts on “Lesson 06.1 – Creating the remaining classes

  1. Is it possible to provide a list of the properties of the 7 new classes as part of the tutorial? Some of us accessing this great tutorial in totalitarian states do not have the luxury of downloading files from github 🙁 Thanks a bunch!

    1. Hello Ken,

      Here’s a DropBox location with the files: DropBox – Lesson 06.1

      I’m going to see if I can either install a Git repository on this site, or find second place to put the files on GitHub. Some of the files get much bigger, so adding them all inside the lesson might not work well. I might not be able to copy everything over to a new location until this weekend, but I will let you know when thethey are ready.

      Please let me know if you cannot access DropBox, or if you know a better file-sharing location you can access.

    2. All the lessons that have code on GitHub should now have links to the same files on DropBox. Please let me know if there is any problem with those files, or with accessing them. Thanks!

  2. Hi! Sorry i was just going to ask in case i’ve missed something but where we supposed to come up with these ourselves or copy your code? Thanks! The tutorial has been great!

    1. Hi Will. You can get the source code for these classes from the GitHub or Dropbox links at the bottom of the lesson (or, just use them from here: classes on GitHub or classes on Dropbox). Create each class by right-clicking on the project name, then “Add”, then “Class”. Then copy/paste the code for the class from GitHub. I just did things that way to keep this page a little cleaner, and not have it full of code.

      1. In a future lesson, we are going to create a “World” class, that will hold collections of all the items, monsters, quests, and locations. We need a way to find the exact item/monster/quest/location in those collections, and an ID is the best way to do that. We wouldn’t want to use the name, because you might change the name (for example, if you were writing the game for a different language – like Spanish).

  3. Hey Scott, I noticed in this lesson the Quest class has a public List.

    This may need to be added to the list above. It maybe in a later lesson, but I figured that it may throw someone off if they cant get to GitHub.

    The QuestCompletionItem.cs from GetHub has this inside:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace Engine
    public class QuestCompletionItem
    public Item Details { get; set; }
    public int Quantity { get; set; }

    public QuestCompletionItem(Item details, int quantity)
    Details = details;
    Quantity = quantity;

    Hope this helps!

  4. Hi Scott!

    Not sure if you look at this anymore, however I hope you do! 🙂 I am creating the new classes but it seems to be missing

    using System.Linq;
    using System.Threading.Tasks;

    Has this been something I missed or just what the new version has? I’m adding them in for now but not sure!

    Thank you!

    1. Hi Daniel,

      It sounds like Visual Studio changed the default “using” directives they include when you add a new class. I don’t think any of the classes will need “System.Threading.Tasks”, but some of the classes will need “System.Linq” in the future. It is safest to include them. If they are not needed, it doesn’t hurt to have them.

  5. Hi I need help lol, my program.cs tab has the super adventure show up as a error.. it goes on to say that it’s being used at a namespace?

Leave a Reply

Your email address will not be published. Required fields are marked *