Building a basic board game - Board, tokens and moving them!

5

Attached Files

The following files have been attached to this tutorial:

.capx

boardgame-movement.capx

Download now 88.05 KB

Stats

8,201 visits, 11,975 views

Tools

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 15 Aug, 2013. Last updated 19 Feb, 2019

Introduction

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

- Arrays

- 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

The board

This 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.

The array creation. Deep stuff.

The tokens

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.

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:

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! :)

.CAPX

boardgame-movement.capx

Download now 88.05 KB
  • 0 Comments

Want to leave a comment? Login or Register an account!