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,
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
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.