I'm learning how to use Lingo within Director and seem to be having some problems with the code in a very unusual way.
The code posted below is supposed to create as many sprites as set to number of sprites and then place it randomly on the stage. The code will randomly choose to create one or two sprites when numberOfSprite is 3.
I decided that I was making a mistake within my code so added an alert box (which is commented out in the code currently). Suddenly the code works 100% every time as long as annoying alert box is shown on each iteration.
Removing the alert and stepping through the code using debugging tools also produces the correct number of sprites. Any insight as to what the Alert function might possibly be doing in the background to make the code work would be appreciated
Question
Greenmeany_uk
Hi
I'm learning how to use Lingo within Director and seem to be having some problems with the code in a very unusual way.
The code posted below is supposed to create as many sprites as set to number of sprites and then place it randomly on the stage. The code will randomly choose to create one or two sprites when numberOfSprite is 3.
I decided that I was making a mistake within my code so added an alert box (which is commented out in the code currently). Suddenly the code works 100% every time as long as annoying alert box is shown on each iteration.
Removing the alert and stepping through the code using debugging tools also produces the correct number of sprites. Any insight as to what the Alert function might possibly be doing in the background to make the code work would be appreciated
repeat with a =1 to numberOfSprites
i = freeChannel()
channel(i).makeScriptedSprite(member("spriteSquare"))
sprite(i).scriptInstanceList.add(new(script "spriteSquares"))
sprite(i).visible = true
the randomseed = the ticks
sprite(i).locH = random(640)
sprite(i).locV = random(480)
updatestage
--alert "Alert"
end repeat
Link to comment
Share on other sites
0 answers to this question
Recommended Posts