I have added this to checkBoundaries to check for collisions between the ball and paddle: (100 is the length of the paddle, I’ll move that to a constant later )
for(float index = paddle.x; index < paddle.x + 100; index++) {
if(xPos == index) {
ySpeed = abs(ySpeed) * -1;
}
}
But I am getting null pointer exception. Where did I go astray here?
Does processing have a simpler way to check collisions?
Thanks,
Marc