topic :
Obstacles of Random Size
myObstacles.push(new component(10, x - height - gap, "green", x, height + gap));
I can't find why (x-height-gap) is used for height if you can explain it it will be big help
https://www.w3schools.com/graphics/game_obstacles.asp