The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

1. 2
posts
Registered User

## Dice Roll Help

Hello everyone.

I am in the process of making a board game, but I can't seem to work out how to make a clickable dice roll and then move the pawn depending on the number which has landed.

I'm using a multidimensional array to make my board which is 10x10.

player = {xsquare:0, ysquare:9};

This code tells the pawn to show on the bottom left square which is the starting square. I want the pawn to move from that position to xsquare:1 if the dice lands on 1 and xsquare:6 if it lands on 6 for example.

When the square reaches x:9 and y:9, it will move up to x:? y:8 and start moving left therefore not going outside the board if that makes sense. The same applies to when its at x:0 and y:8 etc. where it will move up to x:? y:7 and start moving right again in a zig zag direction.

I've already made a dice mc with 6 frames for each number.

I know its a lot to ask, but I've been trying to figure this out for days and any help would be appreciated. Thanks!

look at the example i made there...it will show you all you need.

3. 2
posts
Registered User
Hi I've had a look at your work, it looks great, thanks. Only problem is, I'm not quite sure how to apply it to my specific board I made like I have outlined above. All the timer, coords and steps are confusing me a little.

Edit: Ok I think I understand it after taking another look thanks .

Just one thing I'm not sure on is the if(Math.floor((pawn._y/50)%2)==0).
Last edited by flipsa; April 15th, 2008 at 08:31 AM.

4. Just one thing I'm not sure on is the if(Math.floor((pawn._y/50)%2)==0).
Tht is to tell if the number is even or odd. i.e if the remainder of the equation is 0 than the number is even otherwise its an odd number.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•