Arkanoid/Breakout problem

Topics: Developer Forum, User Forum
Mar 14, 2010 at 2:19 PM

Hi all,

Thanks for helping me on my last thread, which was indeed the issue.. Now I have another, maybe kind of strange problem.

I am still making a Breakout game with farseer and I want the ball to bounce back on a block (inverse Y) when it hits the block. The block must, however, also disappear.

This is a piece of my code (which I think is relevant), the update (in the level):


if (intersect) {
    Config.PhysicsSimulator.Remove(bricks[intersectValues.X, intersectValues.Y].Geom.Body);
    Config.PhysicsSimulator.Remove(bricks[intersectValues.X, intersectValues.Y].Geom);
    bricks[intersectValues.X, intersectValues.Y] = null;
    intersect = false;
    intersectValues = new Point(-1, -1);

for (int i = 0; i < bricks.GetLength(0); i++) {
    for (int j = 0; j < bricks.GetLength(1); j++) {
        if (bricks[i, j] != null) {
            if(AABB.Intersect(ref ball.Geom.AABB, ref bricks[i,j].Geom.AABB)) {
                //Config.PhysicsSimulator.Remove(bricks[i, j].Geom.Body);
                //Config.PhysicsSimulator.Remove(bricks[i, j].Geom);
                intersect = true;
                intersectValues = new Point(i, j);

    bricks[intersectValues.X, intersectValues.Y].Update(gameTime);


Furthermore the brick is set to IsSensor. Now the ball goes right through all the bricks when it collides. Thus where is my problem here?

Kind regards,

Alex van den Hoogen