Turn-Based Battle - Keyboard Controls & Textboxes

14

Index

Features on these Courses

Attached Files

The following files have been attached to this tutorial:

.c3p

tb-battletextbox.c3p

Download now 169.34 KB

Stats

3,497 visits, 6,639 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 24 Mar, 2021.
.C3P

tb-battletextbox.c3p

Download now 169.34 KB

Up until now, the mouse has been used to control the battle system. We're going to make some changes in this version to swap to keyboard controls and have a text-box style system more similar to Pokemon.

In Pokemon games, when a battle starts you're given the option to pick between picking a move, swapping a party member, using an item or (sometimes) fleeing. Once you've made that decision, the same button you used to select the option is then used to progress through the text in the battle turn – it's usually the A button on a controller/handheld system.

We're going to have a MUCH simpler version here in which you'll use a keyboard key to 'pick your move' and that will then trigger the battle turn. The same key will then progress the text through the turn. Later on, when more functionality is added, we can look at expanding this system.

As before, adding in this new mechanic will require a bit of a reshuffle of the existing project structure. To start with, we need to swap some of the global variables.

We're keeping the RandomNumber, PlayerMoved and OppMoved variables as they are. NextAction and CurTurn will be having their names changed to NextState and CurState. They'll now be used to track all the states of the battle system, including player's pick and game over.

The project will also require some new objects. First, you'll need to swap the Mouse object for the Keyboard object. Next, we'll use a light-coloured rectangular sprite to act as a text box, no behaviors or variables are needed the BattleBox is purely cosmetic. In order to stop the player spamming their way through the battle text, we're also going to need a 'Continue' sprite. For this, I've made a small, down-pointing arrow. It doesn't need any behaviors attached to it, but if you want to style it a bit when it's on screen, Sine or Flash are both good options.

As we'll be removing mouse control in this example, the AttackButton sprite is now redundant so that can be removed from the project. The HitStatus object is now the BattleText object and will be used to show all of the text needed in the system – overlay it on the BattleBox to create the text box area. The Continue sprite needs to be set to initially invisible in the properties bar, but it sits in the bottom right of the text box area.

  • 3 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Epic! Thanks for the cool update! Also, Please know that the Dark Mode on your website is 90% of the Reason I will support you guys forever. Its the small details that show you care. ;)

  • hey can you please make a tutorial for a final fantasy tactics grid system movement & attack , i can pay you please

  • nice :)