Skip to content

Instantly share code, notes, and snippets.

@AlphaGit
Last active December 15, 2015 08:19
Show Gist options
  • Save AlphaGit/5229666 to your computer and use it in GitHub Desktop.
Save AlphaGit/5229666 to your computer and use it in GitHub Desktop.
// ArkanoidPlayer
ArkanoidPlayer.prototype = Object.create(DrawableBlock.prototype);
ArkanoidPlayer.prototype.constructor = DrawableBlock;
function ArkanoidPlayer(drawingContext, color, blockHeight, blockWidth, stageWidth, stageHeight) {
var self = this;
self.stageWidth = stageWidth;
self.stageHeight = stageHeight;
self.cornerX = 0;
self.cornerY = 0;
DrawableBlock.call(this, drawingContext, color, (stageWidth - blockWidth)/2, stageHeight - blockHeight * 2, blockWidth, blockHeight);
self.centerPlayer = function() {
self.cornerX = (stageWidth - self.width) / 2;
};
self.centerPlayer();
return {
draw: self.draw,
centerPlayer: self.centerPlayer
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment