Moving on a game board

Hi all,
I would like to know how to move a player’s pawn on a board game. Move is determined through a number variable.
I made a picture to illustrate. For example the player’s pawn is on the square number 1. The dice shows 3, so the variable = +3 and pawn has to move of 3 squares.
The question is how does it go from 1 to 2, then to 3 and finally to the square 4?


Another linked question. The pawn only passes through squares 2 and 3 without stopping. So the actions associated with these squares will not be executed. But if it stops there another time, these actions will be executed. How to do? Ideas?

Add a string object variable on the square object, to indicate where the next square is, and give it one of 4 values - “Left”, “Right”, “Up” and “Down”.

When you move the player from a square, read this variable of that square, and move the player piece accordingly.

It depends on how you move the player. I would look at moving a square at a time, and with each move decreasing the variable that holds the dice roll. If the dice roll is greater then 0, move the player. And if it reaches 0, execute the action of that square.

I understand the idea but i can’t realize it and I meet several problems. Please have a look on my code & screenshots.
case_initiale : initial square
case_arrivee : arrival square
deplacement_restant : remaining movement
deplacement : moving



I think it’s even simpler than I had put earlier. Using your square object - the square the playing piece is on has the variable “prochaine”. Simply find the position of the square that has an id the current square’s prochaine value, and move to it.

Here’s what it look like :


The squares are still what you’ve got. The star has it’s origin moved to the centre, and has variables :

and the code to move it :

The pawn does not stop: it goes around without stopping although I have taken into account your first comment and I copied the first condition/action “at the beginning of the scene”…

It works. Thanks! So please ignore my last post.
I’m testing some possibilities related to this movement…

Please, how do I to retrieve the following values:
-the initial square before each roll/move? it would be substitued by the one of the following movement
-the arrival id, for each roll (is there a better way than Star.Variable(SquareId)?)
-the squares the pawn has been through for each move
-number of turns: whether the pawn only passes through square 1 or stops there= +1 turn

Either use the object variable SquareId on the playing object, or do a collision check between the playing object and square and use the id of the resulting square.

The other way is to check the collision between object and square, and get the id from the collided square.

Use an array, and append each square’s id as you go through it.

Add another object variable, and increment it every time the object crosses square 1

I did it the number of turns variable.

But initial, arrival and crossed squares I cannot do this despite several attempts.
About arrival square: I want to know it as soon as the dice is rolled -before the pawn arrives there.

Also I would like to place a marker and put a sound at each contact of the pawn with the squares. Footsteps would gradually fade as the pawn is moving.

Get the initial value by checking for collision between square objects and the playing piece

The arrival square will will depend on how many squares are in the scene. For the 8 square one, like you have in your screenshots, you can figure out the landing square by using

mod(current_square + dice_roll_value, 8) + 1

Here are the actions to get the initial and arrival squares:

To get crossed squares modify the event I included in an earlier post to :

Playing piece is the pawn? Star in your example?

Since I added platform behavior to squares and platformer object behavior to the pawn, the pawn moves anormally, inside the board and even outside the screen. I don’t know how to make video to show you.

I created the Star.Variable(SquaresVisited)) .Is it value equal 0?

Please see my answer just above


That changes things completely. The solution I gave is for a top-down view, as if you’re looking down onto the board. Platform behaviour is for a side-on view, and applies gravity (usually down the screen) onto the platform character.

So unless you are looking to change the style of game, remove the platform and platform object behaviours.

No You’ll need to click on the spanner icon for the variable, and change it to an array (second option, then choose array when you click on the spanner icon)

When I played I had a long time to figure it out, I didn;t know that I cloud ask for help here)))