# How to do a roulette?

**URL:** <https://community.thunkable.com/t/how-to-do-a-roulette/2089665>\
**Category:** Questions about Thunkable X\
**Tags:** design, beginner, games, help\
**Created:** [October 19, 2022, 11:04am UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665 "2022-10-19T11:04:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![keine.ahnung36sijpe](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@keine.ahnung36sijpe](https://community.thunkable.com/u/keine.ahnung36sijpe)\
**Post date:** [October 19, 2022, 11:04am UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/1 "2022-10-19T11:04:59Z")

</div>

Hi guys, We are from Germany and we are doing a project in our Informatic class, I need a little help on one part of our project :,)

We want to create a game where every player (3 players) chose a color (3 colors) of the roulette and the roulette spins, so at the end one of the color is given. So the roulette has basically 6 layers (2 layers for every color).

Which commands do I need for that? (And We also did not find out how we make the roulette spin)  
We already have a designed roulette!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 19, 2022, 2:07pm UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/2 "2022-10-19T14:07:47Z")

</div>

You can break this project up into four parts:

1. User input and storing of choices
2. Displaying a spinning roulette wheel
3. Random selection of a number
4. Checking if selection matches choices and notifying player(s)

It’s a lot to ask how to do all of this. Which parts have you completed and which ones do you need help with? Have you searched the forums, Google and YouTube for these topics? There are many examples of how to randomize choices.

It’s best to provide what you have made so far (screenshots or project link) and ask specific questions.

---

<div class="post-metadata">

**Author:** ![keine.ahnung36sijpe](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@keine.ahnung36sijpe](https://community.thunkable.com/u/keine.ahnung36sijpe)\
**Post date:** [October 20, 2022, 6:42am UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/3 "2022-10-20T06:42:57Z")

</div>

Thank you for your answer!!  
We already have the wheel designed and the buttons. We do not know how to let it spin and stop after a random amount of time.  
the question is how can we let a picture spin and give out random results.  
we would be really thankfull for an anwser  
greetings  
informatics 101 from Berlin city

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [October 20, 2022, 8:16am UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/4 "2022-10-20T08:16:39Z")

</div>

It’s not possible to rotate components yet.

There are no blocks to do that.

However you can try and use an iframe to load a html file with the spinner and the colors etc. And make it spin from there.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 20, 2022, 8:57am UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/5 "2022-10-20T08:57:37Z")

</div>

If you have an overhead view of the roulette wheel and the sprite’s image is circular, then you can rotate the sprite a small amount (such as 1 degree) by setting the sprite’s direction to the sprite’s direction + 1. See these blocks:

> **[Direction](https://docs.thunkable.com/direction)**
>
> Program a sprite's direction

And repeat that a random number of times. You’ll want to set a minimum and maximum number of times and you may have to adjust the angular velocity. For example, you wouldn’t want to turn the sprite 4 degrees (random set to 4, turn 1 degree) because it wouldn’t really be noticeable and it wouldn’t be a good visual effect. So maybe start with number \>=360.

If you have an arrow or line or other indicator pointing to one part of the circle, then when the sprite stops turning, you determine which number on the roulette wheel was chosen based on what lines up with that arrow. And you calculate it by the starting point of the wheel/sprite and how many turns it made.

It’s sort of like this:

 ![e4083aa9b4587fa7f38bbbb9a9f7a616ec4e8dd1_2_938x1000](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/e/ce1b4bc1c3d9a767c280e6aef4631871a5ae4fd3.jpeg)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 20, 2022, 2:43pm UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/6 "2022-10-20T14:43:44Z")

</div>

Here’s an example of a spinner that decelerates to a random position:

[https://x.thunkable.com/copy/f938c606284c5e0ce868b0522ee6e57a](https://x.thunkable.com/copy/f938c606284c5e0ce868b0522ee6e57a)

(See the first screen with your username.)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/1/11be0d89ab0645f700d1d2f3e45bb6896c28aca8.png)

Here’s a GIF (so it won’t be random but you still can see how it looks):

![ezgif-4-f047c7bc95](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/8/88379f97ba16c785f3e00ddeffd411faf2f493e8.gif)

I actually modified the values a little for the GIF:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7c4d8b53b84d84be68ba5986fd53bba7e1e287f7.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 21, 2022, 3:30pm UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/7 "2022-10-21T15:30:18Z")

</div>

> [@sketch](#):
>
> It’s not possible to rotate components yet.

But you can program it.

---

<div class="post-metadata">

**Author:** ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)\
**Post date:** [October 21, 2022, 7:12pm UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/8 "2022-10-21T19:12:34Z")

</div>

Only sprites i didn’t think about that till tatiang brought it up😅

Or are components now possible to rotate aswel?  
H as vent been on Thunkable much lately.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [October 21, 2022, 7:16pm UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/9 "2022-10-21T19:16:21Z")

</div>

> [@sketch](#):
>
> Or are components now possible to rotate aswel?

Thunkable does not provide the **transform** property dynamically therefore only sprites can rotate.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [January 19, 2023, 7:17pm UTC](https://community.thunkable.com/t/how-to-do-a-roulette/2089665/10 "2023-01-19T19:17:02Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
