Oops don't worry I've fixed it!

I put xPos and yPos lines inside the if statement (in the void draw).