Sign in to follow this  

2D wheel position

This topic is 2538 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i am new to XNA game Dev. I got through by reading some of the e books and posts and got up to start my first game.

I have a simple roulette wheel which and i am able to rotate the wheel successfully. I also have a small ball that rotates in opposite direction to the wheel.Now my problem is ," how to identify on which value of the wheel(0-36) did the ball stop on". How to identify this ?.
Can some one please guide me through this ?. This would be of immense support to move forward.

Share this post


Link to post
Share on other sites
Easiest answer is to tackle the problem from reverse. Generate a random value between 0-36 and then make your wheel end up on that particular value. You then know which value the wheel is on (the wheel is just a graphical representation of the generated random number).

Otherwise you would need to determine the number dynamically. The question is really one of mathematics... You know the starting position of the wheel, the length (or at least the force of the turn) which should allow you to easily determine the value at which the wheel will stop (and this very much depends on how you turn your wheel).

In the worst case assuming none of that is possible I assume you could use separate sprites for different parts of the wheel and check collisions but that seems a bit needless in this case.

Share this post


Link to post
Share on other sites
Hi .. I tried the above solutions, but i have numbers from 0 - 36 arranged randomly on the wheel. I am generating a random number between 0 to 36 and my requirement is to stop the wheel spinning on the the exact number i want ( say number 15 and stop on that). How can i achieve this ?. Please suggest.

Should i use different sprites for each number and check for collision ?.
The wheel i am using more or less looks like the one in the below link, except for the ball i am using it as a separate sprite.

http://www.google.co.in/imgres?imgurl=http://www.gamblingplanet.org/assets/images/editorials/roulette_wheel.JPG&imgrefurl=http://www.gamblingplanet.org/GP_editorial_210208a&usg=__CQOYoNFCRuHr9GwqepdSt7Qi6os=&h=520&w=512&sz=49&hl=en&start=0&zoom=1&tbnid=nf5mQbG4gFzLWM:&tbnh=132&tbnw=138&prev=/images%3Fq%3DRoulette%26hl%3Den%26sa%3DG%26biw%3D1016%26bih%3D570%26gbv%3D2%26tbs%3Disch:1&itbs=1&iact=rc&dur=374&ei=EhIfTcH7Ks_nrAfg95W7Cw&oei=EhIfTcH7Ks_nrAfg95W7Cw&esq=1&page=1&ndsp=15&ved=1t:429,r:6,s:0&tx=109&ty=74

Share this post


Link to post
Share on other sites

This topic is 2538 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this