diff --git a/index.html b/index.html
index 0e90838..4d8b69b 100644
--- a/index.html
+++ b/index.html
@@ -22,7 +22,6 @@
}
-
diff --git a/lib/plugins/component.js b/lib/plugins/component.js
index 82517ed..231e830 100644
--- a/lib/plugins/component.js
+++ b/lib/plugins/component.js
@@ -31,6 +31,17 @@ ig.module('plugins.component')
* Will be called at each Entity's draw call
*/
draw: function () {
+ },
+
+ _extend: function(obj) {
+ for (var key in obj) {
+ if (key in this) {
+ this[key] = obj[key];
+ }
+ else {
+ console.error('You cannot dynamically add properties to components, only modify them. Check your addComponent() method.')
+ }
+ }
}
});
@@ -48,7 +59,7 @@ ig.module('plugins.component')
* @returns {Component}
*/
addComponent: function (comp, settings) {
- $.extend(comp, settings);
+ comp._extend(settings);
comp.delegate = this;
this.components.push(comp);
comp.added();