Collision Detection for multiple objects
I am trying to finish a "Flappy Bird Like Game" that was started in my Code Repo project while completing the Game Development course in Sololearn. Here's what I have so far: https://code.sololearn.com/WWQKGcA79Y66/?ref=app As you can see, I have not written collision detection for the green rectangles yet. I know how to code collision detection for each rectangle individually, but I am wanting know if there is a way to write a collision detection that would cover all of the green rectangles without have to code each one by one? Also, I created each rectangle individually and am running through a loop on the canvas. Is there a way perhaps using Math.random that would allow me to do this? One last item, I heard that there is a way to code collision detection based on color, i.e. when the bird runs into the color green anywhere on the canvas, collision is detected. If so, "How is this written"?