From 29fcfc515d002c18eb0ab0c56dab0f584ccfdd11 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Wed, 26 Feb 2014 01:20:24 +0000 Subject: [PATCH] Fixed TilemapParser - would spit out a tileset warning if margin/spacing were set (fix #485, thanks Cybolic) --- README.md | 1 + src/tilemap/TilemapParser.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c5b63d0..287b3745 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ Bug Fixes: * Swapping between tabs will pause and resume tweens correctly, allowing their onComplete events to still fire (fixes #292) * Fullscreen mode now uses window.outerWidth/Height when using EXACT_FIT as the scale mode, which fixes input coordinate errors (fixes #232) * Fullscreen mode now works in Internet Explorer and uses the new fullscreen non-prefix call. +* Fixed TilemapParser - would spit out a tileset warning if margin/spacing were set (fix #485, thanks Cybolic) TO DO: diff --git a/src/tilemap/TilemapParser.js b/src/tilemap/TilemapParser.js index 973e3917..e6b1e12a 100644 --- a/src/tilemap/TilemapParser.js +++ b/src/tilemap/TilemapParser.js @@ -396,8 +396,8 @@ Phaser.TilemapParser = { newSet.tileProperties = set.tileproperties; } - newSet.rows = (set.imageheight - set.margin) / (set.tileheight + set.spacing); - newSet.columns = (set.imagewidth - set.margin) / (set.tilewidth + set.spacing); + newSet.rows = Math.round((set.imageheight - set.margin) / (set.tileheight + set.spacing)); + newSet.columns = Math.round((set.imagewidth - set.margin) / (set.tilewidth + set.spacing)); newSet.total = newSet.rows * newSet.columns; if (newSet.rows % 1 !== 0 || newSet.columns % 1 !== 0)