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 class you want to create, and add the properties in the class – just like you did with the Player class.
Instead of manually typing in all the classes and properties from this page, get the source code for the classes from the link at the end of this lesson. That way, you’ll be sure to have the spelling and casing correct. That will be important when we start using the classes.
It may not be obvious what all the properties will be used for, but we’ll get to that in a later lesson.
When you’re done
Make sure that your Engine project has all of these classes, and that you didn’t miss any.
- Player (already created in a previous lesson)
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
Get it from GitHub: https://gist.github.com/ScottLilly/ade88e1a92a2ff8799f0
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