Gus89

Dice rolling with sprite

Recommended Posts

I am trying to build a dice rolling animation with collision in a rectangular area (using a dice atlas), is there any example or starting code that could  be of use ?

I searched the Phaser examples and tutorials but couldn't find something similar (i'm kind of new to the Phaser dev community).

Share this post


Link to post
Share on other sites

Thanks for your response @Jackolantern

Ultimately i'm looking to build something quite like this: https://drive.google.com/open?id=0ByODxxIVtyl9UGg1MWY1THhaMlU

Do you think it's possible to build using something similar using faux 3D ? Any starting tutorial/example would be helpful to start with.

Found this interesting project: https://github.com/Rinirihiriro/dice (2D but looks like 3D) however it's not using Phaser. It'd be interesting to have something similar but using Phaser with physics (velocity, collision, rotation) .

The atlas drawn here: https://github.com/Rinirihiriro/dice/blob/master/dice.png seems very close to 3D.

Share this post


Link to post
Share on other sites

Okay, I think that is actually just some nice 2D animation where they have any number of dots showing on the dice as they are rolling, and then the animations would show blank faces up on the last frame and they lay over a graphic of the dots based on a random number generator. That is my guess. Faux 3D is tough, because it leaves a lot of math up to you. I have looked before and have not found anything for Phaser that handles that kind of math for you. There are a few posts about using something like Three.js with Phaser, but I honestly wouldn't go that route. 

 

Really, if I was approaching this, you know what I would do? I would get some real dice, get a table and then rig up a camera or smartphone with an app to take strings of pictures pointing down at the table. Then I would take some series of pictures of dice rolling, find the best ones and trace them in something like Photoshop to make them better fit with your art style. Then just leave those last frames blank so you can add a graphic of the dots. 

 

And this is if you can't find any dice roll graphics available that fit your needs. I would imagine a lot are out there. 

 

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


  • Recently Browsing   0 members

    No registered users viewing this page.