The code you posted won't work, because you're creating a new UIImageView every time that gameLoop or blockCollision is called. You don't have an array to keep track of the blocks on the screen, and you don't have anything to make the blocks move down the screen. I'd go back to the working code that had blocks falling down the screen.
Making the blocks stop when they hit the bottom and stack up... there's no built-in methods for this. At this point you have to think about what method and what data structures you need to write to make it happen.
The method moveBlocks that you wrote needs to know when to *stop* moving a block. So... questions. When do you make a block stop moving? Answer: when it hits the bottom of the screen, or when the entire column below the current block is occupied by other blocks.
How do you know a block is at the bottom of the screen? Answer: Its y coordinate will be greater than some value, like the height of the screen minus the height of a block.
So, your moveBlocks method - the one that loops through all of the blocks - can have a line like if (block.y > screenheight) continue; that will make the loop skip that block once it hits the bottom.
If you get that working I'll explain one way you can tell if a column is occupied. Fingers tired.
__________________

Free Games!
|