Waiting for my flight at the airport when I realized I hadn't packed any dice for my Heroclix(TM) game. Too cheap to buy some real dice, what does the stalwart programmer do? He creates his own VirtualDice of course!
I've included the ico file in the media as well as the sound effects (really me just rattling some pen caps in an empty Heroclix box!) and the sprite file.
` VirtualDice Program
` Created 4/28/2009
` by vidmouse
` For use in games where two 6-sided dice are needed but are not handy
` Use the Enter key to spill the dice and see what you get
` Use the Esc key to exit the program
` Use any other key to continue juggling the dice in the dice box
set window on
set window layout 0,1,0
set window title " Dice Program"
set display mode 150,120,16
load sound "roll.wav", 1 `sound effect is a couple of pen caps being juggled :)
load sound "release1.wav", 2 `then spilled using Windows Sound Recorder
create animated sprite 1, "dice.png", 6, 1, 1 `left die
create animated sprite 2, "dice.png", 6, 1, 2 `right die
repeat
loop sound 1 ` play the juggling sound
repeat ` loop the rolling (in a box)
set sprite frame 1, rnd(5)+1 ` pick which die face to show
set sprite frame 2, rnd(5)+1
sprite 1, 8, 2, 1 ` show the dice in the window (centered)
sprite 2, 75, 2, 2
until returnkey() ` Return key breaks us out of the box
stop sound 1
play sound 2 ` break out of the rolling loop, play the release sound
wait key ` any key will begin
until escapekey()
Vidmouse's Software: http://www.freewebs.com/vidmouse/software.htm