Last active
December 15, 2015 06:49
-
-
Save AlphaGit/5218835 to your computer and use it in GitHub Desktop.
DrawableBlock.js -- taken from https://github.com/AlphaGit/random-javascript/blob/90e6540100631e1a3ae590c3bde4a21b74f7abd9/arkanoid-canvas/arkanoid.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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