Alright, so I get this error when I try to make it so that when BallProjectile collides with an obstacle, the ball stops and makes a new one.
// Checks if the ball is colliding with an obstace, then stops it if it is
BallProjectile obstacleCollision = (BallProjectile) getOneIntersectingObject(Obstacle.class);
if (obstacleCollision != null)
{
xSpeed = 0;
ySpeed = 0;
myWorld.addObject(new BallProjectile(), 50, 559);
return;
}
How do I stop this error? Note that obstacle is just that, a circle created to get in the way of the ball.