JavaScript-UI-and-DOM/Workshops/Canvas-and-SVG/05.08.2016 - Jumping Pikachu/src/js/physics.js
// TODO: replace with circular collision detection logic
replace with circular collision detection logic
replace with circular collision detection logic
function collidesWith(otherPhysicalObject) {
        var self = this;
        var selfLeft = self.coordinates.x,
            selfRight = self.coordinates.x + self.width,
            selfTop = self.coordinates.y,
            selfBottom = self.coordinates.y + self.height;
        var otherLeft = otherPhysicalObject.coordinates.x,
            otherRight = otherPhysicalObject.coordinates.x + otherPhysicalObject.width,
            otherTop = otherPhysicalObject.coordinates.y,
            otherBottom = otherPhysicalObject.coordinates.y + otherPhysicalObject.height;
        return selfLeft < otherRight
            && selfRight > otherLeft
            && selfTop < otherBottom
            && selfBottom > otherTop;
    }
function collidesWith ( otherPhysicalObject ) { var self = this ; var selfLeft = self . coordinates . x , selfRight = self . coordinates . x + self . width , selfTop = self . coordinates . y , selfBottom = self . coordinates . y + self . height ; var otherLeft = otherPhysicalObject . coordinates . x , otherRight = otherPhysicalObject . coordinates . x + otherPhysicalObject . width , otherTop = otherPhysicalObject . coordinates . y , otherBottom = otherPhysicalObject . coordinates . y + otherPhysicalObject . height ; return selfLeft < otherRight && selfRight > otherLeft && selfTop < otherBottom && selfBottom > otherTop ; }
TODO: replace with circular collision detection logic
TODO : replace with circular collision detection logic