[Solved] Better documentation on Loops?

For questions about using Classic.

Post » Wed Feb 17, 2010 5:56 pm

I'm trying to figure out For and While loops, but I just can't grasp how to apply them properly in this event system.

Example of what I want to do (building up on the Ghost Shooter tutorial):

[code:27gqz4qw]monsterDensity = 1

Every 3000ms, run a loop:

loopcount = 0

while loopcount != monsterDensity
spawn monster at random(x,y)
loopcount += 1

[after while loop breaks]

monsterDensity += 1

[/code:27gqz4qw]

I know that's not actual code, but the logic should be sound. How can I put this into event sheets?
B
3
G
2
Posts: 27
Reputation: 729

Post » Wed Feb 17, 2010 6:23 pm

I'm pretty new to Construct myself, so no comment on the code, but wouldn't using a Repeat(MonsterDensity) event be easier here?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Wed Feb 17, 2010 7:39 pm



I didn't notice the repeat loop, but even then I didn't know how to make sub-events. After searching for repeat and playing around a bit... it looks like I got it figured out.

This particular article with pictures was helpful as well... thanks!
B
3
G
2
Posts: 27
Reputation: 729


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests