How to random numbers 1-6 using time event

krazziebone02

  • Posts: 113
i want to know how to random numbers 1-6 in  time event and will loop in 5 times and then after that it will stop the number when the loop is done what process will i do in that??

please help  ???
i want to be the best user of stencyl

krazziebone02

  • Posts: 113
for example i click the actor to random the numbers 1-6 using time event and loop in 5 times so after the loop was done the time event will stop 
i want to be the best user of stencyl

NexusxAlpha

  • Posts: 157
int number = 0;
int randomnumber = 0;
bool TimeEvent = true;

if (TimeEvent =  true && number != 5)
doevery(2 seconds)
{
randomnumber = createrandomnumber(1,6)
number++;
}
else
{
TimeEvent = false;
}

krazziebone02

  • Posts: 113
where should i put this sir?? in time event?? or create my own codes??
i want to be the best user of stencyl

krazziebone02

  • Posts: 113
do you have screenshots sir?? i dont know where i will put that code?? pls post the screenshots i am so newbie stencyler
i want to be the best user of stencyl

Callan S

  • Posts: 147
Hi Krazzie,

Do you want a gap of time between each roll? Perhaps like the wheel of a slot machine, spinning through numbers?

I'd go into attribute and make a number attribute for number of rolls. Also a 'doing a pause' boolean.

Then make an update event, make an if statement (found in the flow menu) that checks if that number of rolls attribute is is below 5 and the 'doing a pause' bolean is false.

If all that's true, make doing a pause = true and then use a 'do after X seconds' from flow/timer. Put that in, inside it make it set 'doing a pause' back to false and to print a random number (random numbers can be gained from numbers and text/math)

This will just print the number to your debuging display for now, because I'm keeping this simple since I'm not sure I know what you want.


krazziebone02

  • Posts: 113
i want to do that numbers is just like the snake and ladders

for example the snake and ladders game was start....so the player will click the  picture  that will randomize the number to know how many steps he\she will step on the board

thats what i want to do

i want to be the best user of stencyl

LIBERADO

  • *
  • Posts: 2660
5 times? Why in 5 times?
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Callan S

  • Posts: 147
I think he wants to show the dice rolling before it comes up with the number.

Krazzie, how far did you get with my instructions? Did you make an actor, go into it's events and do the following?
Quote
I'd go into attribute and make a number attribute for number of rolls. Also a 'doing a pause' boolean.

krazziebone02

  • Posts: 113
sir you are right i want to roll the dice before the number reveals is your code is right??
i want to be the best user of stencyl