Slot Machine Effect?

I am working on the next part of my project that includes a slot machine. The problem I am having is that I can get the animations looping, but I can’t figure out how to slow the animations down before it stops. It’s just like any basic slot machine. Any help would be greatly appreciated.

Thank You

Animation velocity seems to be a fixed value in GD (at least until the most recent version of GD to date and for us, mortals in this side of the UI)… so, you can’t change the velocity of an animation at runtime.

But there are other options, for example, automate the movement of objects trough an algorithm.

I figured that might be the case. I was thinking that I could have the animation cycle for about 2 seconds then pause the animation and finally have a random sprite object chosen and placed where the animation is paused. So it would look like the animation stopped. Would this be possible? If you could give me some ideas I would greatly appreciate it.

Thank You

You can cycle through your own animation at any speed by using: sprite - Set animation number and a timer. You can adjust timers to any time, including variables.

Thanks for the replies!! I got the spin effect working, only problem I have now is that the spin button (starts the animation and events) won’t detect the cursor over/mouse press after the first press. So I have to keep refreshing the HTML file to get it to activate. Any suggestions?

Thank You

Could you give a screenshots of your events? Without it it can only be a guesswork.

Sure!! Here is the code. It is probably a mess because I am still learning. So any pointers would be great :smiley:.

NewObject is the sprite animation.
NewObject3 is the spin button.

Still messing with the Timer and Time scale, but got it to a nice looking level.

Thank You.

Ehrmmm… why are you setting the time scale to 2, then to 1 an then to 0.5 at the same time (12 seconds)?
You have to set the time scale to 2 after (for example) 8 seconds, then to 1 after 10 seconds and to 0.5 after 12 seconds.

And when the spin finished you have to set the time scale to its normal value! Because if you don’t, the game will lag and probably will not detect some input entries (as the mouse click) and thats why you can’t click the spin button for the second time.

1 Like

I fixed all the issues you addressed, but the spin button still does not allow me to click a second time. So I am at a loss on this one. I figured the events would cycle through and then restart. Isn’t that how it is suppose to work? Thanks for the tips so far.


Sorry, there other issues:

  • You don’t need to delete and then re-create the ‘NewObject’ object. You just need to pause the animation and set it to the first frame at the end of the spin.
  • You have to reset the timer after the spin, if you don’t do it, nothing will work for the second time.

This is for you:

Hope it helps! :wink:

It was like I read you process this, pretty cool

1 Like