I have two nested if loops that generate desktopOval objects. No problem. However, when I put in an if/then conditional to jump out of the inner loop, nothing is displayed; not even earlier objects. I tried oval.refresh. laserDot() is in a set. Here is a bit of the code:
For i, For x
for x=laser(i).left to laser(i).left + 200 paint out 200 ovals (later this will be undefined) therefore why the color.blue conditional
You wouldnât happen to have a blue line on the left would you? It seems that if that were the case, the first laser dot would hit the left blue area and prevent drawing as you said.
I agree that itâs generally good practice, but I donât think itâs the issue here. The variable created in the Var reference is literally never used.
The glaring error in this code is the missing definition of n. The value assignment of this variable is not shown in the code â and definitely isnât incremented as the loop creates more and more LaserDot objects â so this is probably where the error is. See my post above that shows how to revise the code to properly reference the object you are creating.
There is nothing in the code the OP posted that suggests where/how he is adding d to laserDot. Also, my comment was directed to Keith. Should have quoted him.
Not to mention that the OP is using âlaserDotâ as both a class name and an array name.