Skip to content

Instantly share code, notes, and snippets.

@richtaur
Created November 30, 2012 20:26
Show Gist options
  • Save richtaur/4178364 to your computer and use it in GitHub Desktop.
Save richtaur/4178364 to your computer and use it in GitHub Desktop.
A component in Djinn's entity/component system.
define({
id: "regenerator",
conf: {
amount: 1,
elapsed: 0,
interval: 1000
},
update: function (dt) {
var conf = this.conf;
conf.elapsed += dt;
if (conf.elapsed >= conf.interval) {
conf.elapsed = 0;
this.callComponents("heal", [conf.amount]);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment