Computer Science Canada I need help with my game.......(breakout) |
Author: | mattparliament [ Wed Dec 19, 2007 9:32 am ] |
Post subject: | I need help with my game.......(breakout) |
i need help to find out how to get the block in my game to disapear when i hit it with the ball, also to get the ball to bounce of it. PLEASE HELP |
Author: | Euphoracle [ Wed Dec 19, 2007 3:33 pm ] |
Post subject: | RE:I need help with my game.......(breakout) |
Sure. To make the block disappear, have a boolean true/false for each block. If it is true, draw it and do hit detection, which leads to our next point. Each frame, check if the ball has collided with a block. If it has, reverse the direction of the ball and set the boolean we discussed earlier for the block to false. When the ball hits a wall, do the same thing, reverse the direction (but do nothing to any booleans). For help with collision detection see this. |