I would suggest both methods! Have two play types on the menu: Survival and Standard
With survival, you could have the ball speed up as you progress. And instead of inserting a row on the top when the bottom row is gone, Just move all the bricks down and insert a new line at the top after a certain amount of time has passed. The player could get a point for each brick that is broken, and maybe a multiplyer for breaking several bricks with one paddle reflection. When the udpate comes and a new row is added, if the bottom row moves too low, then: GAME OVER! Your Score is: ####
With standard, you could have several different levels with different brick layouts. Example:
1111111
1111111
1111111
or:
0101010
1010101
0101010
or:
0001000
0111110
0101010
or:
1111111
1000001
1111111
And for the way of storing the brick information, I would use a 2 dimensional array and a User Defined Type. The array can be used to relatively store the positions of the bricks, and the UDT will give each brick in the array multiple adjustable attributes. Plus, it makes me feel like I'm OOPing.
`Set up variables, arrays, images, and sync
sync on
sync rate 60
load image 1, "YourRedBrick.jpg"
load image 2, "YourGreenBrick.jpg"
load image 3, "YourBlueBrick.jpg"
load image 4, "YourPlayersBall.jpg"
type BrickType
image as integer
alive as boolean
endtype
type PlayerBall
x# as float
y# as float
speed# as float
image as integer
endtype
ball as PlayerBall
ball.x# = 0.0
ball.y# = 0.0
ball.speed# = 1.1
ball.image = 4
global brickLayoutWidth = 10
global brickLayoutHeight = 5
dim Bricks(brickLayoutWidth - 1, brickLayoutHeight - 1) as BrickType
for y = 0 to brickLayoutWidth - 1
for x = 0 to brickLayoutHeight - 1
Bricks(x, y).image = 1
Bricks(x, y).alive = 1
next x
next y
do
User_Input()
Game_Logic()
Draw_Bricks()
sync
loop
end
function User_Input()
`Get User Input
endfunction
function Game_Logic()
`You'd also do any other computations in here as well but
`I'm just going to show the way to use the Brick array for collision
`You'd put code here to move the ball first so that you can get it's
`updated position. But I didn't want to program this part. So...
`Now, we check collision:
for y = 0 to brickLayoutWidth - 1
for x = 0 to brickLayoutHeight - 1
if Bricks(x, y).alive = 1
if Collision_Check(ball.x#, ball.y#, x, y) = 1
Bricks(x, y).alive = 0
`You'd add some code here for the ball to change direction.
`as well as update our Player's score
endif
endif
next x
next y
`Other things such as updating the time and if Bricks need to drop
`down a row, etc.
endfunction
function Collision_Check(x1#, y1#, x2, y2)
if x1# > x2 - 7.5 && x1# < x2 + 7.5 && y1# > y2 - 2.5 && y1# < y2 + 2.5 then collision = 1
endfunction collision
function Draw_Bricks()
for y = 0 to brickLayoutWidth - 1
for x = 0 to brickLayoutHeight - 1
if Bricks(x, y).alive = 1
endif
next x
next y
endfunction
(This is really rough code. Don't have DBP at work, so I used notepad.
It's not playable, and I don't even think it will compile. It's mostly just showing structure.)
What everyone said above is correct. I just wanted to go into a bit of detail. Hopefully, it's not too confusing for you.
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.