Board game issue - player moving in one direction, but with few "turns"

Hi there,

I’ve recently downloaded and started using GDevelop 5 and for a beginner - I find it quite good :slight_smile:

A little background on my question. Im creating a test board game, in which the player moves in one direction only, but the “path” of the player makes a few turns around the boards. The movement is determined by the result of the dice, not by any user input.

The correct progression of the events should be as follows:

  1. player clicks a button that rolls the dice.
  2. the animation of the dice and the result should be the same (i.e. if the dice displays 3 and 5, the result variable should be 8).
  3. Once the result is determined, await 2 secs, then automatically move the player object the said number of times

Example of the player movement can be seen in the below picture (excuse the quality, but it was quickly scetched up):

.

So, my questions:

a) how can i make the animation of the dice to be equal to the actual result of the dice and where do I store the result (scene variable, global variable, any other variable) ?
b) how to calculate the position of the player and then add the result from the dice to the new position of the player (Effectively move the player as per dice result) ?
c) once player reaches the end of the row, how do i make him go around?

If details are not enough, please kindly let me know so that i can answer any questions that might arise.

In the meantime I will continue searching and testing, and if i figure this out by myself, I will update with answer :slight_smile:

1 Like

Well, I would create a “structure” scene variable, and load the ID of each square along with the XY coordinates. For each player, I would store the current square ID in another scene variable. When you roll the dice, you get the number of steps to do on the board. You move along the “structure”, taking as a base the players current square ID and move the player sprite to the new XY coordinate of the next square ID.

The structure could have the following form:

I’m afraid I’m not aware of a better approach to arrays in GDevelop. Also, this is not tested, but this is pretty much how I would start approaching the movement.

What type of board game is it?

1 Like

I see what you mean.

Once I get back to my computer, I will give it a go. If it works, then i will have b) from my questions above sorted :slight_smile:

Oh and in turns of what game that would be - let’s just say it will be a strange mixture between monopoly and rpg :smiley: I have the idea and the functionality in my head, now it’s just a matter of me finding the correct GDev tools and functionalities to implement it :stuck_out_tongue: