Loops works fine inside events, but you have to understand how C2 execute code.
When C2 reads it start from the top and go through each event and execute whatever it should.
When it reaches a loop it will repeat the loop X amount of times, before moving on.
The wait statement is a bit weird and think that might be what confuse you. The wait statement, doesn't store X amount of waits even if you repeat it 90 times. It will do it once when the wait timer is up.
There are nothing wrong with using loops in conditions as long as you know how C2 handles them. Hope that makes it a bit clearer.
Well, loops inside events aren't truly executed within an event if it is as you say. I will post another topic on NESTED LOOPS, which may be what I was getting at. Other programming languages handle loops entirely within their nested position in code, without the use of global variables...it seems C2 does not.
In most programming languages I've worked with, an example like this:
On Mouse.click
{
Repeat(90)
{
System.Wait(1)
Sprite.Rotate(-1)
}
}
here you can see that the loop, Repeat(90), is nested inside an event, Mouse.Click. Here, when the mouse is clicked, it starts the Repeat loop which will: tell the system to wait 1 increment of time, then rotate the sprite counterclockwise 1 degree, then tell the system to wait 1 increment of time, then rotate the sprite counterclockwise 1 degree, then tell the system to wait 1 increment of time, then rotate the sprite counterclockwise 1 degree, then tell the system to wait 1 increment of time, so on and so forth until that was done 90 times and THEN exit the loop. Inside the loop code, Repeat, it executes whatever commands it finds there from top to bottom until it is done and then it exits the loop.
C2 seems to run a nested loop only once and then exits. Of course, if the loop isn't nested in C2, it seems to work fine. At least, that is how I see it so far.