Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

45 строки
851 B

  1. define([
  2. 'js/rendering/renderer'
  3. ], function(
  4. renderer
  5. ) {
  6. var scale = 40;
  7. return {
  8. type: 'particles',
  9. emitter: null,
  10. init: function(blueprint) {
  11. this.blueprint = this.blueprint || {};
  12. this.blueprint.pos = {
  13. x: (this.obj.x * scale) + (scale / 2),
  14. y: (this.obj.y * scale) + (scale / 2)
  15. };
  16. this.emitter = renderer.buildEmitter(this.blueprint);
  17. },
  18. update: function() {
  19. if (this.ttl != null) {
  20. this.ttl--;
  21. if (this.ttl <= 0) {
  22. if (this.destroyObject)
  23. this.obj.destroyed = true;
  24. else
  25. this.destroyed = true;
  26. return;
  27. }
  28. }
  29. if (!this.emitter.emit)
  30. return;
  31. this.emitter.spawnPos.x = (this.obj.x * scale) + (scale / 2);
  32. this.emitter.spawnPos.y = (this.obj.y * scale) + (scale / 2);
  33. },
  34. destroy: function() {
  35. renderer.destroyEmitter(this.emitter);
  36. }
  37. };
  38. });