I am trying to display some animated Dice on a board, the dice code works fine in a separate app and it runs in my code partially. What it doesn't do is display the dice initially, it will not show up till I hit the key to stop it from rolling and then it will work from there on, also if I move the window on the screen it will disappear again. I have the code below if someone can tell me what I'm missing it would be appreciated.
set window on
set Display mode 1024,768,32
set window title " Dice Program"
iconhandle=load icon("11264.ico")
set window layout 1,1,1
backdrop on : color backdrop 1
Sync On : Sync rate 0
load sound "media\roll.wav", 1 `sound effect for rolling dice
load sound "media\release1.wav", 2 `then spilled using Windows Sound Recorder
create animated sprite 1, "media\dice.png", 6, 1, 1 `left die
create animated sprite 2, "media\dice.png", 6, 1, 2 `right die
Do
randomize timer()
ink rgb(255,255,255),0 : box 205,154,820,616 ` Center box
ink rgb(255,0,0),0 ` Row 1 Col 1 : box 0,0,205,154
ink rgb(0,255,0),0 ` Row 1 Col 2 : box 205,0,410,154
ink rgb(0,0,255),0 ` Row 1 Col 3 : box 410,0,615,154
ink rgb(255,0,255),0 ` Row 1 Col 4 : box 615,0,820,154
ink rgb(0,255,255),0 ` Row 1 Col 5 : box 820,0,1024,154
ink rgb(255,0,255),0 ` Row 2 Col 1 : box 0,154,205,308
ink rgb(200,200,200),0 ` Row 2 Col 5 : box 820,154,1024,308
ink rgb(215,25,75),0 ` Row 3 Col 1 : box 0,308,205,462
ink rgb(120,180,247),0 ` Row 3 Col 5 : box 820,308,1024,462
ink rgb(255,98,255),0 ` Row 4 Col 1 : box 0,462,205,616
ink rgb(250,255,210),0 ` Row 4 Col 5 : box 820,462,1024,616
ink rgb(155,60,155),0 ` Row 5 Col 1 : box 0,616,205,780
ink rgb(100,200,100),0 ` Row 5 Col 5 : box 820,616,1024,780
ink rgb(0,255,0),0 ` Row 5 Col 2 : box 205,616,410,780
ink rgb(0,0,255),0 ` Row 5 Col 3 : box 410,616,615,780
ink rgb(255,0,255),0 ` Row 5 Col 4 : box 615,616,820,780
GOSUB _RollDice
Sync
Loop
end
_RollDice:
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, 315, 515, 1 ` show the dice in the window (centered)
sprite 2, 382, 515, 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()
RETURN