In this video Jesse Freeman teaches you how to connect up the monster’s attack logic. You’ll modify the battle loop by first tracking whether the player attacks next, then you’ll add in logic to let the monster perform an attack action and finally you’ll return control back to the player so the can attack back or run away.
- [Voiceover] Now it's time for us…to connect up the monster's attack logic.…Let's go back into our battle window.…We're gonna need to modify the OnAction method.…We're gonna make it a little bit more generic.…This way, we can call it from either…the player or the monster.…To do this, let's go and replace…the value of int id that gets passed into OnAction.…And now, let's pass in a GenericBattleAction.…And we'll call this action,…and we'll also pass in an Actor,…and we'll call this target1.…
And an Actor, and we'll call this target2.…Next, we can delete the variable…where we choose the action from the action's array,…since we're already passing this in.…And now let's further make this more generic…by replacing the player with target1…and the monster with target2.…Now we're gonna need new methods…for when the monster and player attack.…Below this, let's create a new public method…with the return type of void, and…we're gonna call this OnPlayerAction.…
And here we'll pass an int id,…just like we did previously.…Next, we'll create a new variable for the action…
- 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.