Skip to content

Instantly share code, notes, and snippets.

@AlphaGit
Last active December 15, 2015 06:49
Show Gist options
  • Save AlphaGit/5218835 to your computer and use it in GitHub Desktop.
Save AlphaGit/5218835 to your computer and use it in GitHub Desktop.
// DrawableBlock: DrawableEntityBase
DrawableBlock.prototype = Object.create(DrawableEntityBase.prototype);
DrawableBlock.prototype.constructor = DrawableEntityBase;
function DrawableBlock(drawingContext, color, posX, posY, height, width) {
DrawableEntityBase.call(this, drawingContext, color);
var self = this;
self.posX = posX;
self.posY = posY;
self.height = height;
self.width = width;
self.draw = function() {
self.ctx.fillStyle = color;
self.ctx.fillRect(self.posX, self.posY, self.height, self.width);
};
return {
draw: self.draw
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment