P5 game ball bouncing bug

I am trying to make a game with a ball that bounces off the platforms, but every once in a while the ball falls through the platform and I can’t figure out when or why.

https://github.com/lizzybrooks/Bouncingball/blob/master/Test%20game%202/sketch.js

there is a problem with the x position you check in bounce

  • -a- pls make a variable like:
    var platlength=100;
  • -b- make the platform with:
    line(this.x, this.y,this.x+platlength, this.y);
  • -c- check the bounce with:
    if (this.x >= platforms[i].x && this.x <= platforms[i].x+platlength && …

Thank you so much! <3 <3<3<3<3<3<3