Array beginners - what am I missing?

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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:

    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)
    [/code:3lebd4bs]
    
    it does draw the grid but debugging it shows inifite objects being created... am I missing something?
    
    Thanks!
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)