Физика лестницы JavaScript

if (this.x < subject.x + subject.width && this.x + this.width > subject.x && this.y < subject.y + subject.height && this.y + this.height > subject.y)
{
    this.canFall = false;
} else
{
    this.canFall = true;
}
Comfortable Caterpillar