Congratulations, you’ve reached the final post on this project. We’ve come a long way and added a ton of features. In this lesson I will just add a bit of polish, and then round it out by adding some challenges for you to try on your own.
Polish
There are a couple of components I that didn’t quite fit into my other lessons, so we will add them now. The first is a way to make the pawns on the game board always face the camera. As it is now, they look too flat because you are seeing them from an angle.
To fix this, I created a Billboard component. This script will cause a GameObject to always rotate to face another target GameObject. I left the target field public so that it is more reusable – it might be helpful in case you had more than one camera and you need to manually assign it. Otherwise it will automatically grab a reference to the main camera in OnEnable. Since this component uses the Update method it will be rotated every frame – I cache a reference to its own transform component for improved performance.
public class Billboard : MonoBehaviour { public Transform target; Transform cachedTransform; void OnEnable () { if (cachedTransform == null) cachedTransform = transform; if (target == null) target = Camera.main.transform; } void Update () { cachedTransform.LookAt (target); } }
Our last bit of polish will be to make the TileMarker objects rotate. These are the PokeStops and Gym icons that appear over the board tiles. All we need to do is activate a Tweener in the Start method. I modify the loopCount to ‘-1’ to represent a loop forever setting, and set the animation curve to linear so it just spins without any slowing down or speeding up.
public class TileMarker : MonoBehaviour { public Transform display; void Start () { Tweener tweener = display.transform.RotateToLocal(new Vector3(0, 360, 0), 3, EasingEquations.Linear); tweener.loopCount = -1; } }
Challenges
In order to test how well you have understood the material so far, I decided to include some challenges. They are somewhat sorted based on what I think the challenge level will be – from easiest to hardest, and I have added options that span most of the game’s architecture.
Audio
- Add extra sound fx. This game was pretty light in this area, so try adding button clicks, transition screen swooshes, dice rolls, level up sounds, or any other bit of audio polish you can think of.
- Cross fade music. Instead of just cutting between tracks, use multiple audio sources as necessary so you can animate the volume of one clip out and the next one in.
- Add a settings menu with options to mute and/or adjust the volume of SFX and music.
Screens
- When switching the camera focus to a new pawn, try animating the camera into place.
- Try to create a new screen transition, such as a cross fade. Hint, try using a CanvasGroup component’s Alpha.
- Create a custom Game Over screen. Dress it up with new images, text, animation or particles, etc. Make the player feel rewarded for winning.
Random Encounters
- Add a variable spawn rate to the SpawnPokemon board tile’s component. Use the new variable in the RandomEncounterSystem so that some tiles are more likely to have a random encounter than others.
- Figure out how to mark a tile with a terrain type, and use the terrain type in the appropriate system so that certain types of Pokemon will only appear on certain terrain types.
- Modify a capture battle so that wild Pokemon have a chance to flee as they take damage, so that you may have a good reason to attempt a capture before they are KO’d.
- Allow a player to choose what Pokemon they fight with in a capture battle, similar to how they form a team in a gym battle, but still only selecting a single combatant.
Evolution
- Consider putting evolution constraints on the Evolution System. For example, a minimum level before evolving to a level 2 or level 3 form, or requiring special items.
- Add support for multiple evolution branches. For example, when an Eevee is evolved allow it to become a Vaporeon, Jolteon, or Flareon at random.
- Add mega evolutions. Allow a pokemon to return to its original form after battle.
Random Stuff
- Try adding additional items, like higher level potions, and modify the screens as necessary so you can choose what item to use.
- Try using save slots. Add a menu screen as necessary to allow a player to specify where to save or what file to load, like you might see on a variety of GameBoy games.
- Try a more complex game board with branching paths – something like you might see in Mario Party. Add the necessary states and UI so that when a player reaches a branch they can select which way to go.
Summary
Besides finishing off the last few random polish tasks of this project, the real focus on this lesson is to encourage you to try something on your own. As you work through these challenges, any areas that aren’t understood will be brought to light. As always, feel free to ask questions here or in the forum if you get stuck.
Don’t forget that there is a repository for this project located here. Also, please remember that this repository is using placeholder (empty) assets so attempting to run the game from here is pretty pointless – you will need to follow along with all of the previous lessons first.
If you find value in my blog, you can support its continued development by becoming my patron. Visit my Patreon page here. Thanks!
I’m curious if its possible to add in AI players for the game?
It is certainly possible to do, though I am not currently working on this series. I do have examples of AI in my other projects such as the Tactics RPG and Trading Card Game, and my hope is that by following along with my various tutorials that it would enable you to branch out and implement features on your own. If you want to give it a go and get stuck, feel free to reach out on my forums and I’ll try to lend a hand.