Sign in to follow this  

breakout: bonuses in bricks, how?

This topic is 4687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites

This topic is 4687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this