So I am in class and am trying to figure out how to do a certain animation on my project. We are making a CRAPS game and I want the die to randomly switch sides to the background music until the music stops to show that the die are done and you get your result. I cannot figure it out how to do so. Could you guys please help?
here is my code. the song is about 7 seconds
os.execute (“cls”)
display.setStatusBar (display.HiddenStatusBar)
local bckgrnd = display.newRect (0, 0, 480, 320)
bckgrnd.y = 160
bckgrnd.x = 240
bckgrnd:setFillColor (20, 124, 12)
local table = display.newImage (“craps.2.png”)
table.y = 170
local Rollcount = 0
local Roll = display.newImage (“roll.png”)
Roll.y = 280
Roll.x = 250
local d1s1 = display.newImage (“1.png”)
d1s1.y = 160
d1s1.x = 100
local d1s2 = display.newImage (“2.png”)
d1s2.y = 160
d1s2.x = 100
local d1s3 = display.newImage (“3.png”)
d1s3.y = 160
d1s3.x = 100
local d1s4 = display.newImage (“4.png”)
d1s4.y = 160
d1s4.x = 100
local d1s5 = display.newImage (“5.png”)
d1s5.y = 160
d1s5.x = 100
local d1s6 = display.newImage (“6.png”)
d1s6.y = 160
d1s6.x = 100
local d2s1 = display.newImage (“1.png”)
d2s1.y = 160
d2s1.x = 380
local d2s2 = display.newImage (“2.png”)
d2s2.y = 160
d2s2.x = 380
local d2s3 = display.newImage (“3.png”)
d2s3.y = 160
d2s3.x = 380
local d2s4 = display.newImage (“4.png”)
d2s4.y = 160
d2s4.x = 380
local d2s5 = display.newImage (“5.png”)
d2s5.y = 160
d2s5.x = 380
local d2s6 = display.newImage (“6.png”)
d2s6.y = 160
d2s6.x = 380
local RollMusic_mp3 = audio.loadStream (“Music Super Mario Kart - Item Box (Ding, Ding).mp3”)
function Roll:tap (event)
audio.play (RollMusic_mp3)
end
Roll:addEventListener (‘tap’, Roll)
[import]uid: 129092 topic_id: 24880 reply_id: 324880[/import]
