HTML and CSS Reference
In-Depth Information
return this;
}
this.Intersects = function(rect) {
if(this.left + this.width < rect.left)
return false;
if(this.top + this.height < rect.top)
return false;
if(this.left > rect.left + rect.width)
return false;
if(this.top > rect.top + rect.height)
return false;
return true;
}
}
3.
For our next step, we will need to create a new instance of the Enemy object inside
of the Level object, and we also need to position an enemy unit within the Level
constructor.
this.enemy = new Object;
this.tileWidth = 0;
this.tileHeight = 0;
this.InitLevel = function(width, height) {
this.tileWidth = tile.width;
this.tileHeight = tile.height;
for(var i = 0; i < 50; i++)
{
this.tiles[i] = 1;
}
this.enemy['10'] = 'Enemy';
this.AddTile(width, height);
this.AddEnemy(width, height);
return this;
}
 
Search WWH ::




Custom Search