Sign in to follow this  
sefiroths

2d throw dice how to implement?

Recommended Posts

I would like to develop an interface that the 2d click of a button throws of the dice.
roll the dice on the table and are seen from above the table.
I was wondering how you could implement this or if there is already a code to display this roll of the dice.
I dropped to 3d for such a thing?
programming language, preferably c, c, but if you have examples in any language are welcome

thanks

Share this post


Link to post
Share on other sites
So, you want to click a button on your interface, which calls some kind of "dice roll" function. And this dice roll needs to be visually represented in your game/program, right?
You could either make ONE 2D Animation of a dice rolling, where you cannot actually make out which face is on top after you have rolled it. Then, you present the user some kind of close up image of the face that corresponds to your generated random number.
OR you could use this for your advantage:
http://i1.creativecow.net/u/119014/cube-layout.gif
Just use your dice as map and try to dynamically create a seamless and infinite image out of it. When you roll the dice, make the small window (that you use to look at the part of the cube map) travel with a random speed and direction. Apply some friction, the center of the window should then determine which face is finally up.

OR you could load a 3D model of your dice, create some physics (hardest part), roll it and determine which face is up.

Share this post


Link to post
Share on other sites
Quote:
Original post by sefiroths
http://gizmodo.com/5023627/iphone-dice-g...nd-physics


Google will often display truncated URLs, so one has to be careful when copy+pasting search results directly from the results page.

Share this post


Link to post
Share on other sites
This is a total mix of different issues.

  • Choosing a random number from 1-6
  • Rendering a 3D scene
  • Animating a rolling die
  • Linking the animation to the resulting number on the die


  • The first is quite simple but the rest are complex topics. Looking for "code" to achieve this is not going to work.

    Break the problem down into more detailed steps than I've described and examine each step in isolation would be my advice.

    Share this post


    Link to post
    Share on other sites

    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