Skip to content

Instantly share code, notes, and snippets.

@unstoppablecarl
Forked from th1agoalmeida/button.js
Last active December 12, 2015 10:08
Show Gist options
  • Save unstoppablecarl/4756496 to your computer and use it in GitHub Desktop.
Save unstoppablecarl/4756496 to your computer and use it in GitHub Desktop.
FeatureButton = ig.Entity.extend({
size: {
x: 100,
y: 50
},
r: 0,
b: 0,
init: function(x, y, settings) {
this.parent(x, y, settings);
this.l = ig.system.realWidth - this.size.x - this.r;
this.t = ig.system.realHeight - this.size.y - this.b;
console.log('init')
},
draw: function() {
this.parent();
console.log('draw');
ig.system.context.fillStyle = 'red';
ig.system.context.fillRect(this.pos.x, this.pos.y, this.size.x, this.size.y);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment