If else statement not working

I am a beginner and wanted to made this sketch of a ball that squishes before it bounces back, hover it doesn’t squisches at al and I don’t get the squishing part of the sketch to work without removing all of the movement. Does anyone know what I am doing wrong?

this is a link to my sketch: https://editor.p5js.org/julan/sketches/kWq1q7gJJ

1 Like

Hi julan,
Take a look at line 23. You are checking if the x size of the ellipse is larger than the canvas width. This isn’t going to have the effect you want.

Happy coding.


yes, that solved the problem. Thank you verry much