How do I move a sprite after dice roll?

Just started using Construct 2? Post your questions here

Post » Fri Apr 10, 2015 4:45 am

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!
B
6
S
1
Posts: 3
Reputation: 356

Post » Fri Apr 10, 2015 10:51 am

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?
The Aurora Borealis? At this time of year? At this time of day? In this part of the country? Localized entirely within your kitchen?
B
11
S
2
Posts: 16
Reputation: 638

Post » Fri Apr 10, 2015 7:24 pm

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.
B
6
S
1
Posts: 3
Reputation: 356

Post » Fri Apr 10, 2015 8:42 pm

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.

drive.google.com/file/d/0BxiyVK_wBh3vem45M2cxV1NrNU0/view?usp=sharing

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.
The Aurora Borealis? At this time of year? At this time of day? In this part of the country? Localized entirely within your kitchen?
B
11
S
2
Posts: 16
Reputation: 638

Post » Fri Apr 10, 2015 10:38 pm

For only rolling dice thing, I have one here: https://dl.dropboxusercontent.com/u/659 ... _dadu.capx
ImageImage
B
91
S
43
G
21
Posts: 739
Reputation: 20,448

Post » Fri Apr 10, 2015 11:21 pm

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

alextro,
I have the dice set up already but I'll check that out anyways. Thanks!
B
6
S
1
Posts: 3
Reputation: 356


Return to Beginner's Questions

Who is online

Users browsing this forum: wakd and 1 guest