Jump to content
  • Advertisement
Sign in to follow this  
kaz123

2D wheel position

This topic is 2788 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!