Quote:
if(yPos < 290){
yVel *= 1;
}
What do you think that block is going to do? If you're moving back up (
yVel < 0
), multiplying the velocity by
1
isn't going to change it.
-2 × 1 === -2
You need to test whether the object is too far up, and then multiply the velocity by
-1
again.