Results 1 to 4 of 4

Thread: Dice Roll Help

  1. #1

    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!

  2. #2
    http://www.kirupa.com/forum/showthread.php?t=293001

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

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


  3. #3
    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. #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.

Thread Information

Users Browsing this Thread

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
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012