Board game movement

Started by MrNashington, Thu 10/10/2013 22:26:03

Previous topic - Next topic

MrNashington

Hello AGS forums,

I am working on my second game: "No Strings Attached", which is a board game made with AGS.
Anyway I was wondering if there is a good way for movement around the board. I have been stuck trying different things out and so far I haven't succeeded.
The player moves around the board monopoly style by pressing the dice button.
Any help would be appreciated!

Thanks, Charlie

Lupo4u2

Hey!

you could use a grid (2-dimensional array) - like for a tile-based game - in which you use an number for your player possible movements.
Example for a 4x4 grid:






1444
1003
1003
2223

the possible direction (e.g. variable: movDir) for your player are:
1 = move down
2 = move right
3 = move up
4 = move left

After you've rolled the dice, you check the current position of your player in the grid, get the next direction and move accordingly.
So, when the player starts in the top-left field, it will read the movDir == 1 and you know that you must walk down.
Attention: You must move your player always only by 1 position and then check again the next direction, before your next move... otherwise the player  will miss the corner. ;)



MrNashington


SMF spam blocked by CleanTalk