| 12345678910111213141516171819202122232425262728293031 |
- 'atomic component';
- //Imp component
- exports.component = function(self) {
- //Link to the current node
- var node = self.node;
- var animatedSprite = node.getComponent("AnimatedSprite2D");
- //Listen events and set animation
- self.subscribeToEvent(Atomic.ScriptEvent("PlayRun", function() {
- animatedSprite.setAnimation("run");
- }));
- self.subscribeToEvent(Atomic.ScriptEvent("PlayIdle", function() {
- animatedSprite.setAnimation("idle");
- }));
- self.subscribeToEvent(Atomic.ScriptEvent("PlayAttack", function() {
- animatedSprite.setAnimation("attack");
- }));
- self.subscribeToEvent(Atomic.ScriptEvent("PlayHit", function() {
- animatedSprite.setAnimation("hit");
- }));
- self.subscribeToEvent(Atomic.ScriptEvent("PlayDead", function() {
- animatedSprite.setAnimation("dead");
- }));
- };
|