In this tutorial I describe one way to set up a basic board game. I'll go through creating the board, tokens and moving the tokens. It's designed to be easy to expand, so you can start adding your own rules and mechanics on top of it with little effort. This could be the base for more traditional board game or turn-based strategy game.
Prior knowledge and requirements
This tutorial requires some prior construct 2 knowledge, so you should be familiar with following concepts:
- UID's and IID's
- Behavior expressions
The full .capx file is attached to this tutorial.
There are lots of comments in the .capx file, so most of the details are explained there. This tutorial mostly overviews what the example file holds.
Requires: MoveTo plugin by rexrainbow
Open full size imageThis is the basic board. Squares and tokens!
Lets start with the board. It's done with sprites (note the uniform size of 64x64) to give control over what is happening on the board. The square sprite in the example .capx has two animations; one for walls and one for standard empty squares. Walls block movement, they have the solid behavior enabled. The squares are linked together with an array, which is representation of the board in numerical form. This allows us for example to easily refer to surrounding squares, it is used to highlight the movement range of tokens.
This example requires that the board is rectangular, but you can set squares invisible if you wish to go around this limitation.
Open full size imageThe array creation. Deep stuff.
The possible token movements are highlighted when you click on a token. This utilizes the array we built at start of the layout to check if the neighboring squares are free to move into. In this example, walls and other tokens block movement.
Open full size image
Moving a token with range of 2 squares. As you can see, other tokens and walls are blocking movement
The token movement is done using pathfinder behavior. When pathfinder finds it's route, we create movement markers on the board to display the squares token moves through. The movement itself uses custom MoveTo plugin for convenience. You can fetch the plugin here:
Open full size image The token movement. As you can see, it's quite 'automated' and just done for purpose of this tutorial. If you wish your tokens to move in different way, it's easy to modify. That's it!
Feel free to message me with any questions or improvement suggestions! :)
Unlock your full gamedev potential
Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!
Plus, it's got a lot of additional features that will help you save time and make more impressive games!