Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Removed an awfully wrong example.
Browse files Browse the repository at this point in the history
  • Loading branch information
scambier committed Oct 27, 2014
1 parent 59e5845 commit ecad048
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 5 additions & 1 deletion lib/game/components/clickable.js
@@ -1,9 +1,13 @@
ig.module('game.components.clickable')
.requires('plugins.component')
.defines(function () {

CmpClickable = Component.extend({

someParam: 'lorem',

onClick: function() {
console.log('click');
console.log('Click on Entity ' + this.delegate.id + ' - ' + this.someParam);
},
_inEntity: function () {
return ig.input.mouse.x + ig.game.screen.x > this.delegate.pos.x &&
Expand Down
9 changes: 3 additions & 6 deletions lib/game/entities/block.js
@@ -1,6 +1,7 @@
ig.module('game.entities.block')
.requires(
'impact.entity',
'plugins.component',
'game.components.clickable'
)
.defines(function () {
Expand All @@ -13,12 +14,8 @@ ig.module('game.entities.block')
this.addAnim('idle', 1, [0]);

this.addComponent(new CmpClickable(), {
// Using the second parameter of addComponent, we can add a new method
// or override an existing one
onClick: function () {
// The component's delegate references the entity
console.log('Click on Entity ' + this.delegate.id);
}
// Using the second parameter of addComponent, you can override default values
someParam: 'ipsum'
});
}
});
Expand Down

0 comments on commit ecad048

Please sign in to comment.