Object instances stacking problem
Hello.
I have problem with working with ForEach loops and collision detection for many instances of the same object.
I'm trying to make a game where randomly generated tetris blocks fall from the top to bottom, litter the level, stack on each other and are removed by players, causing other tetris blocks which were on that block to fall. Considering it's a tile-based game, all blocks which are not obstructed by anything, will fall tile down.
I'm trying to figure out simple way to keep this mechanic to work, and I just can't. At my best attempt blocks were indeed detecting collisions (thanks to masks) with each other and bottom, but game went more and more laggy because of big number of objects (due to number of masks - each block had one), and removing masks caused the blocks to go bananas.
I tried using both foreach loop and fast loops but I can't figure out how could I use them efficiently, tutorials and instructions just don't help much. I couldn't find any tutorial specifically about stacking many instances of the same object on top of each other (for tile-based game of course). All I achieved so far is frustration and sanity loss :I