breakout: bonuses in bricks, how?

Started by
7 comments, last by GameDev.net 19 years, 2 months ago
I was thinking on how I can make my game of breakout more exciting when I figured I can put bonuses in bricks. For example ounce the ball destroys a brick a bonus of 200 points might be flying down. The problem is that I'm not sure how to implement this. I have a level editor that when I place a brick in a certain spot it stores the number 1 in a 2d array. Any ideas on how I can implement a bonus system into the level editor?
Advertisement
I don't do any game programming usually, but I'm pretty sure you can just assign some sort of marker to whatever brick (be it random or chosen) that would make either a random or set item/bonus fall down in the paddle's direction.

I don't say that would be very hard to implement.
You could give your array another depth ([x][y] for existance, non existance, and [z] for triggers). 0th depth could be existance, 1st depth could be points, 2nd depth could be special items, etc.

Or you could use some sort of random generator in realtime. Nobody would really notice, and it would add more excitement and replayability.
That sounds like a good plan too, sure.
There are 10 types of people in the world. Those who understand binary, and those who don't.
Instead of storing an 2D array of ints, you could use a 1D array of structs which hold all kinds of properties for your tiles. By doing this you can extend the tiles any way you like and you're also not bound to a fixed grid.

Something like this:
struct s_tile {  int x,y;  int type;  int bonusitems;  bool CheckCollision();};std::vector<s_tile> Tiles;
Good ideas guys. I'll try and see what I can hack up with the current code I have written.
There's no need to 'mark' a brick as containing a bonus. Each time a brick is broken you can generate an evenly distributed random number between say 1 and 100, if the number is less than the percentage of bricks you want to have bonuses then the brick has a bonus.
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
AND you could assign different probabilities of getting each bonus to each different brick color, thus no need for extra data ('cept for a separate table of colors/probabilities). This will give the player clues as to which bricks may contain stuff.

Note, if you were to tag each individual brick with a bonus, another matrix dimension is overkill since that will give you brick[x][y][z] and what you want is two values per [x][y]. Sure, you could only allocate for z=0 and z=1 but....better just make a matrix of structs, and store whatever data you want for each brick, like mentioned above. And bonus! you can mix datatypes.
Working on a fully self-funded project
Aside from creating the struct mentioned above, just assign ints to a 2d array so that 0 = brick cleared, 1 = normal brick, 50 = 50 point brick, etc.

This topic is closed to new replies.

Advertisement