rsDice jQuery Plugin

As part of the big update I am making to Blackeden Down I am making a huge overhaul to how the battle sequence is made. Currently there are huge amounts of functions working with random numbers. Dependant on the difficulty level, this changes how these functions might return the relevant information. I have a sequence of images that I am using jQuery to change classes in order to make it look like the dice is changing as a ‘roll’ *sigh* I wish I knew what I knew now, way back when!

I have decided to make this system much more smaller, quicker & efficient. One thing I have done is to remove the concept of difficulty levels when playing against the AI. This allows me to create something generic and not specific for the game, hence why I am sharing this with you! I came up with a simple but effective jQuery plugin that allows you to show numbers changing as it if where ‘rolling’ not animated roll, just simply scrolls through the numbers randomly. At the end of the sequence you are left with the number you can use for what ever purpose. Try the demo below –

6
6

Usage

After including jQuery and the rsModal plugin, instantiate rsModal like so:

Options

option description default type
number Numebr of sides for the dice 6 int
speed The speed of which the text changes 100 int
duration The length of time it takes for the dice to roll 2000 int

Leave a Reply