How do I move a sprite after dice roll?

0 favourites
  • 6 posts
From the Asset Store
Roll Craft design For programming and publishing to other platforms
  • Hello Scirra Forums!

    I'm currently making my first game and having a hard time solving this problem. What I need is to move sprites along a grid column/row, moving from one end to the other, a certain number of spaces after a dice roll. I made a dice with 0-5 slides that spins and picks a random 1-6 side, I need to connect the movement to the dice roll. So it's a turn based, dice roll, sprite1 moves, then next person rolls, sprite2 moves, so on and so on.

    Thanks for helping me out!

  • Hi Three2Five

    Good question, although do you mean that when the dice is rolled the sprite moves completely in one direction (such as five right or four up) or do you mean that when a dice is rolled the player can move any amount of up/down/left/right a number of times equal to the dice roll?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply, MShaw.

    When the dice is rolled, the sprite will move from left to right, depending on what the dice lands on.

    It's pretty much a race from one end to the other using the dice to decide how many spots it moves.

    Hope that clears it up a bit more.

  • Ah yes I get you.

    I have made a small example which I hope helps. I added in comments which explain what things do but if there is anything I have missed or you want to ask about anything than don't hesitate to ask.

    I have never used google drive before and for some reason I cannot attach files so I hope that link works

    The example uses a dice button to generate the number but I'm sure that what you are using can be easily converted across since you just need to save the result into two global or local variables.

    The only issue is that I haven't animated the movement so they sort of teleport to their new position, I am almost certain that the Custom Movement behavior could fix this but I am quite new so have not touched on that behavior yet.

  • For only rolling dice thing, I have one here: ... _dadu.capx

  • MShaw,

    Thank you so much! That works great! This will help me a lot, again thanks for the quick reply.


    I have the dice set up already but I'll check that out anyways. Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)