How do I get the ball to intersect the second row?
From ggc
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.
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?
- This page was last modified on 13 March 2008, at 16:18.
- This page has been accessed 218 times.
- Privacy policy
- About ggc
- Disclaimers
- Powered by MediaWiki!









