Computer Science Canada

Collision effect

Author:  Junaid2pac [ Sat Jan 19, 2008 12:25 pm ]
Post subject:  Collision effect

i have a game in which a ball is thrown and it hits a circulat object which is also moving (circular object is drawn by:
code:
e.drawOval();)
)
i also have a background in the back...now how would i make the circular object dissapear when the ball hits the circular object...
Note: I have already done the math for collision detection.

Author:  HellblazerX [ Sat Jan 19, 2008 2:20 pm ]
Post subject:  Re: Collision effect

You could use a boolean to keep track of whether or not you need to draw the ball.
code:
if (notHit) {
     e.drawOval ();
}

and when your collision occurs, just set the boolean to false, and you won't draw the ball anymore


: