How do I create object using specific numbers in loop index.

0 favourites
  • 6 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • I have a function that creates objects by using a loop.

    0,0 _ 0,1 _ 0,2 _ 0,3

    1,0 _ 1,1 _ 1,2 _ 1,3

    2,0 _ 2,1 _ 2,2 _ 2,3

    3,0 _ 3,1 _ 3,2 _ 3,3

    For "X" from 3 to -1:

    For "Y" from 3 to -1:

    ......................................Create tiles... etc

    So now I need it to only render when "X" or "Y" loopindex equals 0 or 3.

    In other words I want it to only render on the edges of the made grid and not in the center.

    I can't find/think of a way to compare the loopindex of each loop or to insert a variable into it somehow.

  • For X from 0 to 3

    For Y from 0 to 3








    Create tiles

    In C2 you add the conditions first, then convert the block to use OR, via the context menu (right-click the left most part of the event and choose "Make 'Or' block").

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make 'or' Block is what I was needing for the Or statement, I would have had to look that up, Thanks for that solution.

    What I meant is how do I compare a loopindex() or how do I use a variable to get a loopindex?

  • I figured it out. I had "set Variable to Loopindex" in the loop event, but in the loop's sub-event I still had it referencing loopindex instead of the variables, so I was thinking they were being ignored... Opps.... Thanks again for your time.

  • You want something similar to this: ... rLoop.capx

  • That is what I was asking. I couldn't figure out how to put loopindex into a sub-event, so I ended up making a local variable. I didn't think of adding loopindex into "Compare two values". When I think "Compare two values" I think of Instance, local and global variables. Still learning how flexible Construct 2 is. Thanks again. You're always helpful.

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