We currently define all of our game data in code. We did this for simplicity and to learn the coding concepts without worrying about data management. If we want to add a new GameItem, we need to code that into the ItemFactory. But as we grow our game, we really need to move all of … Continue reading Lesson 4.11: Load Item Data From JSON File
Month: September 2020
Lesson 4.10: Attack Initiative and Hit Logic
Now that we have the Battle class, we're going to make the combat more interesting. Currently combat is very static... the player attacks and monster and then the monsters respond with their own attack. Attacks always hit the opponent and cause a random amount of damage. But that's really all the variance in the combat … Continue reading Lesson 4.10: Attack Initiative and Hit Logic
Lesson 4.9: Enhanced Combat with Battle Class
In this lesson, we are going to focus on refactoring our combat functionality out of the GameSession view model. There are various methods that deal with combat and handle either player or monster deaths, so it would be helpful to encapsulate all of the combat related code into its own Battle class. We are also … Continue reading Lesson 4.9: Enhanced Combat with Battle Class
Lesson 4.8: Create Centralized Message Broker
As we plan to refactor and expand the combat system, we notice that there are a lot of messages returned from combat methods that need to be displayed. Our plan is to refactor the combat code out of the GameSession class and into its own class that manages the intricacies of combat. To make it … Continue reading Lesson 4.8: Create Centralized Message Broker
Lesson 4.7: Ability to Display Quest and Recipe Data
Currently we have the quest and recipe data concisely shown in the Quests and Recipes tables that only display their names and status. Once we get past the original receiving of the quest, it can be difficult to remember that is needed to complete a quest or recipe. So we are going to enable the … Continue reading Lesson 4.7: Ability to Display Quest and Recipe Data
Lesson 4.6: Add Keyboard Shortcuts for Game Operations
Part of a good game is being able to take multiple forms of input. To this point, we have focused on touch and mouse input. In this lesson, we will add keyboard input to the game and handle keyboard keys and shortcuts to perform specific game actions, like moving or fighting or using a consumable … Continue reading Lesson 4.6: Add Keyboard Shortcuts for Game Operations
Lesson 4.5: Craft Items with Recipes
With the popularity of games like Minecraft, building and crafting items from base components has become very common in games. It has found its way into many of the latest roleplaying games as well. So let's build the concept of recipes (ingredients for making items) and crafting into our game engine. Recipe Model Changes The … Continue reading Lesson 4.5: Craft Items with Recipes
Lesson 4.4: Create the First Consumable Item
Most game players are familiar with consumable items - these are single use items that are used to provide the player an effect... like a potion of healing that lets us rejuvenate some of our hit points. This is a common concept in many roleplaying games. So we are going to introduce a Granola bar … Continue reading Lesson 4.4: Create the First Consumable Item
Lesson 4.3 Monsters Attack with Weapons
Since we moved the player's weapon to use the Attack command/action, it makes sense to do the same with the monsters too. The monsters are technically fighting with their natural weapons, be it a bite or claw attack. But if we want our hero to eventually fight other humanoids, then those would also fight with … Continue reading Lesson 4.3 Monsters Attack with Weapons
Lesson 4.2: Refactoring to Use Attack Command
With a working game engine, it's time for some changes to make it more flexible and able to support an ever-growing list of features and functions. One large refactoring that we will make is to replace the weapon and monster attack behavior with an Attack command instead. We will learn and use the Command design … Continue reading Lesson 4.2: Refactoring to Use Attack Command