I am attempting to create collision detection between an object(bouncing ball) and all squares generated, which is done by clicking on the button.
if(object1.x< object2.x+object2.width&&object1.x + object1.width>object2.x&&object1.y<object2.y+object2.height&&object1.y+object1.height>object2.y)
How, if possible, can object1 values can be from any and all object1 generated by CSS?
Press the click button to generate the object with will triiger the collision.
I was thinking adding object properties to an array every time a new square is created would be the way to go, but I am kind of at a lost at this point. Do I need to create a separate array for each: x, y, width and height of object1?
Any guidance would be welcome. I don’t know what am I making…just learning!