Array beginners - what am I missing?

Get help using Construct 2

Post » Fri Feb 21, 2014 2:53 pm

I've recently bought Scirra personal edition, so I'm sorry if I sound kinda n00b :)

I'm looking at arrays right now, and I'm simply trying to draw a 3*3 grid. I got a sprite called Cube, so in the events sheet I put:

Code: Select all
System-For "GridCols" from 0 to 3
    System-For "GridRows" from 0 to 3 -> System-Create object Cube on layer 0 at (loopindex("GridRows")*50, loopindex("GridCols")*50)


it does draw the grid but debugging it shows inifite objects being created... am I missing something?

Thanks!
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Fri Feb 21, 2014 3:02 pm

I read ahead about event sheet runtime, and saw it runs endless from top to bottom, so I guess it keeps creating them because the loop occurs again. so I added a "on start of layout" as the first condition, and all works just fine :)
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Fri Feb 21, 2014 4:25 pm

Either that or put them on a condition that does not continuously occur if you don't want it to only happen at start of layout.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,603

Post » Fri Feb 21, 2014 5:04 pm

I ran into a problem like this as well, I crated a global verbal to make things grow, so when i needed it to add. It changed the global verbal and then when it was done it changed it so it would not grow anymore.
B
14
S
4
G
1
Posts: 61
Reputation: 1,464


Return to How do I....?

Who is online

Users browsing this forum: ounound and 16 guests