I have a film loop of one little animation sprite (only one
jump). I need to
control that when push a button the film loop run and finish
but when the button push again, the film loop run again but
in the new
location and so on.
Do you know how ?
Select the filmLoop. In the Property Inspector at the Film
Loop tag, remove the check mark from the Loop box.
Suppose your filmLoop sprite is in channel 1:
vSprite = sprite(1) -- HARD-CODED
-- Check if the filmLoop has finished playing
vFinished = (the frame = the lastFrame)
if not vFinished then
-- The filmLoop has not played to the end
-- If we get here, the filmLoop has played to the end. Move
-- a new place, and play it again.
vLoc = randomLoc() -- use the point you want to move the
vMember = vSprite.member
vMember.loop = FALSE
vSprite.loc = vLoc
on randomLoc() -- temporary handler for testing purposes
vRect = (the stage).rect
vRandomH = random(vRect.width)
vRandomV = random(vRect.height)
return point(vRandomH, vRandomV)