diff options
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/wall.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index 6c20444..e327070 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -51,14 +51,17 @@ window.Wall = (function(){ Wall.prototype.bounds_for = function(img) { var coord = this.side & FRONT_BACK ? this.rect.x : this.rect.y - return new Rect( new vec2( coord.a + img.width/2, coord.b - img.width/2 ), - new vec2( img.height/2, Rooms.list[this.room].height - img.height/2 ) ) + var halfWidth = img.width/2 * img.scale + var halfHeight = img.height/2 * img.scale + + return new Rect( new vec2( coord.a + halfWidth, coord.b - halfWidth ), + new vec2( halfHeight, Rooms.list[this.room].height - halfHeight ) ) } Wall.prototype.fits = function(img){ - if (this.side & FRONT_BACK && this.rect.x.length() < img.width) { + if (this.side & FRONT_BACK && this.rect.x.length() < img.width * img.scale) { return false } - if (this.side & LEFT_RIGHT && this.rect.y.length() < img.width) { + if (this.side & LEFT_RIGHT && this.rect.y.length() < img.width * img.scale) { return false } return true |
