# How to make an lucky wheel?

hello friends

i want to make an lucky wheel for my game , please anyone can guide me?

Hi! You could create the sprite of the wheel, and put the origin at the wheelâ€™s center. Then just make the sprite turn modifing the angle some degrees every sceneâ€™s step, substracting a bit of that quantity until a random time. The result obtained may be defined for angle ranges, like for example, â€śfrom 0 to 45 degrees, the price is 100\$â€ť

2 Likes

You may want to describe what you want a bit better - not everyone will be familiar with what a lucky wheel is.

Iâ€™m going to assume itâ€™s like a wheel that spins around with a set of prizes on it. In which case, youâ€™ll want a sprite of the wheel. Add an instance variable to hold the spin time - make this 2 decimal places to ensure the spin time is reasonably random. Then start an object timer. Have an event that checks if the timer is < the spin time, and if so increase the spriteâ€™s angle by a set amount.

Once the timer > spin time, get the resulting angle and have a set of events that hold angle ranges and the prize that belongs to that range.

Ha, beaten by @ars_creativa by a few seconds

2 Likes

The lucky wheel of responses!

2 Likes

thank you guys a lot for paying attention

yes i want a lucky wheel for giving some prize to my users

is that possible please make an example project for me?
because iâ€™m new here and just can edit projects , i will be very thankful if you help me

thank a lot

can you please? i will be very thankful

Not a complete project, but a section that will do what you are after. If there are actions or conditions you donâ€™t understand, check in the wiki first, and then post on the forums if youâ€™re still stuck.

Create your lucky wheel sprite. add a number object variable named â€śSpinDurationâ€ť and a boolean object variable named â€śIsSpinningâ€ť

Use the following code to spin the wheel:

1 Like

thank you so much for your kindness

i want to set a button for user to see one ads , then he receive one score to spin lucky wheel
so i want to know
i want to prize real money , so its should be a little hard for earn money , so is that possible to set chance of win for each prize?

Sure, just make the angle/segment smaller than the rest.

can you please make this project and send me files? i try but couldnâ€™t make it

looks like iâ€™m do it wrong

would you please make a project for me as i want and send me files? i can pay you

Sorry, Iâ€™m not doing a complete project. What Iâ€™ve given you is pretty much a complete set of events.

I suggest you follow the GDevelop 5 Tutorials, and post on this forum if you run into any problems.

1 Like

its not a complete project , i just want lucky wheel part
or you can just send me that file from screenshot

That looks good. Thanks for sharing