In this video Jesse Freeman will teach you how to add random battle events to an RPG tile map as the player explores it. You’ll create a change of random attack and then link a call back to when the player enters a new tile to determine if a random encounter happens. You’ll also learn how to keep random battles from happening on tiles such as the castle and the town while guaranteeing them on dungeons.
- [Voiceover] Now that our battle system works,…it's time for us to trigger random battles…as the player moves around the map.…To do this, let's open up our random map tester.…Towards the top of our class where we set up our player,…let's set up a new range.…We'll use 0 for the minimum and .9f for the max.…And we'll create a new public float…and call this randomBattleOdds,…and we'll set this equal to .3f.…
Now let's scroll down to our tile action callback method.…Right now we're displaying a message…based on what tile our player enters.…Let's go ahead and comment that out…by selecting it and hitting Command on a mac…or Control on PC and slash.…In its place, we're gonna create a switch statement.…And we're gonna test the type of tile that's passed in…to the tile action callback.…The first case we're gonna set up is 21.…
This happens whenever we walk on top of a dungeon.…We'll add a break, and inside of the case,…let's go ahead and call StartBattle.…So now whenever we walk within a dungeon,…we'll immediately start a battle.…
- 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.