Collision Map is returned and default values added.

This commit is contained in:
Richard Davey 2017-09-13 13:15:47 +01:00
parent 3b268569f1
commit 358a4c8df5
2 changed files with 4 additions and 2 deletions

View file

@ -9,9 +9,11 @@ var CollisionMap = new Class({
function CollisionMap (tilesize, data)
{
if (tilesize === undefined) { tilesize = 32; }
this.tilesize = tilesize;
this.data = data;
this.data = (Array.isArray(data)) ? data : [];
this.width = (Array.isArray(data)) ? data[0].length : 0;
this.height = (Array.isArray(data)) ? data.length : 0;

View file

@ -96,7 +96,7 @@ var World = new Class({
{
this.collisionMap = new CollisionMap(tilesize, data);
return this;
return this.collisionMap;
},
/**