How to build multiple Objects with just one line of code

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello guys. I have a problem that may be something simple, but I couldn't find a solution. I need to use the system to build multiple blocks on the screen when I enter a certain room, the blocks are destructible sprites that when you destroy them, items drop, (like in the mario game) they need to be aligned next to each other simulating a brick wall (they cannot overlap) are 31 blocks horizontally and 12 blocks vertically for a total of 372 blocks in a room. I could make the system create block by block indicating the position of each one, but that would take too long and the lines of code would be gigantic, I need to do this in many game rooms so this would take too long to do. I wanted to know if there is a way, some mathematical operation that could put all the blocks in their respective places with just one or two lines of code. I appreciate any help.

  • Here is an example:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could do it also with only one loop:

  • You could do it also with only one loop:

    Thank you very much Asmodean this fit like a glove. I didn't know about this Loopindex function, I spent almost 12 hours trying to figure out a way to do it but without success, thanks a lot guys :)

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