I know how to make the dice roll random by repeatedly changing the graphics then set a final graphics.. But now I want some player involvement. I want the player to stop the roll. It does not work how i want it.
I tried using the loop and this is my setup:
It looks good to me, the only place I could think there would be an error is in your "Random" variable since I don't see it defined anywhere within the loop, meaning a) it's not working because Random doesn't ever equal 1, 2, or 3, or b) i'm just stupid and i can't figure out what the problem is xD
- You didn't initiate the random value. Just the condition.
- You repeat the same command. That's just inneficient.
- You use wait. it will cause delay because it has to finish the "wait" command first before checking the "press ok" condition.
Here's the fix :
- It uses a variable as an alternative of wait. So delay 10 * wait 1 frame wil be equal to 10 frame wait.
- You don't need to set the sprite image again after stopped because the loop already break.
- I put the random variable directly inside the script call so it doesn't need to be checked again.
Unless it wasn't supposed to be random and the visual have to change 1, 2, 3 in sequence...
thanks! i think it needed to be in sequence, because it can appear the same image x3 in a row which is like a freeze.. also i removed the sound effects as the swapping of image is not in sync with the sound effect.
How am i able to reset the dice roll? i can only get it to work once. it wont repeat again?
I have a problem.. to trigger the event I use action button which is the same as the "okay" button in the condition. the reroll does not re-trigger properly with the action button. I need mouse click to re-trigger the event..
Oh... you triggered the event with action button? I get what you mean. The image sometimes doesn't change because I use random value there, and by random it mean sometimes it hit the same number again.
Here's a fix :
- The delay initialized as -1 beforehand as an indicator that it will only be executed if you release the "ok" button first. Then you can press the "ok" button once again to stop it.
- The graphic visual repeat 1, 2, 3 in sequence now by using modulo (mod) operator.
- The final outcome will be randomized. If it doesn't fit your need, delete the part in red box.