I'm creating a game with a sort of 'Candy Land' mechanic, but with dice... Roll a dice, move piece as many spaces as the dice rolled. I need to get the player's current position and define its next position (pseudo :: nextpos = currentPos + 1; moveTo nextPos x diceRoll). I thought the best way would be defining the gameboard in an array, and nextPos would basically be the next key in the array, but I'm still unsure how to do that, or even if it's the best solution. Any guidance is appreciated.
If the path is strictly linear, then an array would likely be a reasonable solution. If you need help with the details, let us know what language you're using, and what part of the implementation you need help with. (You can edit your original post and add this information.)
The path traveled is linear, so where
I'm really needing help is how to 'go
to' the next position in an array from
the current position.
It's difficult to explain, but it should be very straightforward. In theory, each array variable holds a position on the game board, correct?
And each array space is numbered.
From there, it's extremely simple. If you roll a 6, you'd tell the piece to move itself to BoardSquare[(myCurrentSquare + 6)]. It should then move to the 6th array vector.
Does that make sense?