• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Breakout style game questions

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1Russ[x2]  Members

Posted 08 January 2000 - 10:06 AM

Hi all, I''m really just looking for some general info on the creation of a ''Breakout'' style game (you know, the one kinda like pong but with loads of blocks to destroy ). I''ll basically have my tile matrix ([num_tiles_x][num_tiles_y]) kinda thing, representing where the tiles are. But what would be the best collision detection type of routine to be used with such a game? Would it be best to keep track of where the ''ball'' is relative to the tile grid coordinates etc? That''s pretty much it to be honest If anyone has some info on a suitable collision detection approach, or any general tips for a game like this, the info would be appreciated Oh, and one more thing... What is supposed to change the velocities of the ball in these style games? From what I can figure out playing some of them, if the ball hits dead center of the ''racket'' it goes straight up, and any devience to the left or right alters the angle of the balls trajectory left/right respectively. But I''ve also noticed the ball speeding up whilst colliding with bricks etc. Anyway, like I said, any info appreciated, thanks, -- Russ

### #2mason  Members

Posted 08 January 2000 - 12:42 PM

1) Make a function that returns the tile position for a given pixel (ball) position.

2) Every frame, check to make sure the ball isn''t somewhere it shouldn''t be. If it is, kill the tile that its at (using function you wrote in step 1), then deflect the ball''s x and y velocity. I believe TANSTAAFL posted the exact equation in another message a few months ago.

Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com

### #3PoesRaven  Members

Posted 08 January 2000 - 03:38 PM

a really simple algorithm for changing ball speed is to invert the speed with
speedx = -speedx;
speedy = -speedy;

### #4SiCrane  Moderators

Posted 08 January 2000 - 08:30 PM

Or if you''re feeling in an OOP mood, you can tell each of your objects its bounding box and then every frame do an intersection test of the ball against every brick. It''s a little computationally expensive, but breakout isn''t going to tax anyone''s system.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.