In this video, Jesse Freeman will teach you the basics of building generic actions for your RPG by leveraging the command design pattern. The command design pattern allows you to encapsulate code in a responsible way and perform these actions as needed. In this case an RPG attack action will be build on top of this generic action class.
- [Voiceover] Now that we have our player and our monster…inside of the battle window,…it's time for us to create our battle actions.…We're gonna use something called the Command Pattern.…A Command Pattern is a type of design pattern in programming…that allows us to encapsulate actions…inside of a class and reuse them over and over again.…We're gonna build a generic action which will be the base…for any of the actions we add into our RPG.…In this case, we'll end up building a simple attack one.…
To get started, let's go into our Battle Systems folder,…into Scripts and Create a new C# Script.…We're gonna call this Generic Battle Action.…And let's open it up in MonoDevelop.…Now, our battle action is going to be a scriptable object…just like our actors.…So let's make it extend Scriptable Object.…We'll also delete the start and update methods.…At the top of our class, let's add a name.…So we'll do, public new string name.…
Next, we'll create a protected field…typed as string and we're gonna call this message.…And we'll set it equal…
- Preparing the user interface
- Creating game and message windows
- Building a battle window
- Adding a monster and action buttons
- Creating an actor class
- Adding player and monster attack actions
- Triggering battles from the map
- Ending a battle
- Cleaning up the battle and attack systems
- Rewarding the player
Skill Level Intermediate
1. Preparing the UI
2. Message Window
3. The Battle Window
4. Actor Classes
5. Battle Actions
6. Cleaning Up Combat
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.