WEEK: 12
Active: March 30th - April 5th
Work Due: April 6th @ 11:59 PM

Collision Review

So, remember, we can use this collision method below.

function hasCollided(object1, object2) {
    return !(
        ((object1.y + object1.height) < (object2.y)) ||
        (object1.y > (object2.y + object2.height)) ||
        ((object1.x + object1.width) < object2.x) ||
        (object1.x > (object2.x + object2.width))
    );
}

You will need to iterate over your array objects each time you move and check to see if you have collided with all the objects on the page. Give it a try!


Previous section:
Next section: