Nov 13, 2013 at 2:02am UTC
i had a look and i think i will keep following my one.
but i just want to know how they would work. of course i am going to finish my breakout first but i just want to know
Nov 13, 2013 at 3:59am UTC
Depending on how you go about it, one of several solutions may present itself to you in the course of plugging away at your breakout game. You did say you wanted to figure out things yourself. ;)
Nov 13, 2013 at 4:29am UTC
:|
i knew i would regret saying that
Nov 14, 2013 at 1:54am UTC
but seriously how do they work
Nov 14, 2013 at 10:40pm UTC
I came into this thread late, and you keep saying "they" and I don't really know what you're asking about.
I tried checking your earlier posts but didn't see anything. Can you restate what you're asking about?
Nov 14, 2013 at 11:07pm UTC
You could do that a number of different ways. First way that comes to my mind:
1) The "board" could be 2D grid where each value represents one square block.
2) The "current" piece can be an object that keeps track of which 'blocks' on the map it occupies.
3) When the current piece hits the bottom, you throw away the object, and update the 'board' grid, filling in the blocks that the piece occupied.
4) Check for full rows and remove them, giving the player appropriate points.
5) Check for "game over" if the block landed above the upper bound of the grid.
6) Start at step 2 with a new piece. Repeat until game ends.