How do I get the ball to intersect the second row?

From ggc

Jump to: navigation, search

If you play the game, the first row of bricks reacts in the way I planned--when the ball collides, it bounces and removes that brick. The next time the ball comes to that point where the brick was removed, it bounces off the non-image (where the brick used to be). Any suggestions?

I have tried to set the stage after it intersects and after it removes the brick, but then there are problems with the ball intersecting the other bricks.

GBell/Breakout

Sure, there are a few ways to handle this. The easiest way is to simply set the sprite invisible by calling the method setVisible(false) on the sprite. For example, if you had a Sprite called dot, you would call dot.setVisible(false) and the dot would no longer appear on the canvas. When checking for collisions, check for both visibility and intersection:

if(dot.isVisible() && dot.intersects(ball)) would be a good check. If the ball is invisible, this condition will be false. Does this provide enough help for solving your problem?





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter