Random Numbers Just Like The Rolling Dice In Snake And Ladders

krazziebone02

  • Posts: 113
I want a random numbers 1 - 6  just like the rolling dice in snake and ladders but i will apply it in actor's animation is somebody can help me?? :)
i want to be the best user of stencyl

krazziebone02

  • Posts: 113
for example i will click an actor to random the numbers 1-6 and then automatically will stop is there anyone can help me??
i want to be the best user of stencyl

Indigo

  • Posts: 23
First make an attribute (game attribute if the number needs to be used across scenes or be stored between plays) and make sure the attribute is a number.

Now start with an event triggered by clicking on the actor.

In that event put the setter for your attribute. in your setter put the random number block and set your upper and lower bounds



Let me know if you have any problems :)

krazziebone02

  • Posts: 113
what if i will use it in time event??
i want to be the best user of stencyl

Indigo

  • Posts: 23
I don't quite understand what you mean by using it in a time event? can you describe what you want your game to do?

You could put the same sort of code in a "do every ___ seconds" loop, or in a "do after __ seconds" loop if that's what you mean?

Callan S

  • Posts: 147
I think he might mean an 'always' event.

Krazzie, the following should work in an always event (you'll need to add a draw event that draws it as well)

krazziebone02

  • Posts: 113
i want is to roll the dice and then after the roll the dice will step and for example the dice reveal the number 5 so the player of the snake and ladders will move a 5 steps
i want to be the best user of stencyl

krazziebone02

  • Posts: 113
sir Callan S your code is correct but itis slow rolling what will i put to make faster rolling  the numbers
i want to be the best user of stencyl