Advertisement
7rodo

Snowflake Functions

Sep 7th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Paste this in server.js these may be difficult to add. You can ask me for some help*/
  2.  
  3. // Spawn_on Death (optimised frag) you must know where to put this
  4. if (set.SPAWN_ON_DEATH != null) {
  5.             this.spawnOnDeath = set.SPAWN_ON_DEATH;
  6.         }
  7. //use ctrl + f and search 'Check for death' and put it under "if (this.isDead()) {"
  8. let _body = this;
  9.      
  10.             if (this.spawnOnDeath != null) {
  11.                 this.spawnOnDeath.forEach(function(i){
  12.                   for(let j = 0; j != i.N; ++j){
  13.                     let o = new Entity({x: _body.x + ran.irandomRange(-4, 4)
  14.                                        ,y: _body.y + ran.irandomRange(-4, 4)
  15.                     });
  16.                     o.define(i.T);
  17.                     o.color = _body.color;
  18.                     o.team = _body.team;
  19.                     o.master = _body.master;
  20.                     if(i.VEL) {
  21.                       let a = Math.random() * 2 * Math.PI;
  22.                       o.velocity.x = Math.sin(a) * i.VEL;
  23.                       o.velocity.y = Math.cos(a) * i.VEL;
  24.                     }
  25.                    
  26.                   }
  27.                 });
  28.                 this.spawnOnDeath = null;
  29.             }
  30. // Phase 2
  31.  if (this.frag === 'snowflake') {
  32.             let color = this.color
  33.             let frag = this.frag
  34.             let size = this.SIZE
  35.             var random = ran.randomRange(-100, 100);
  36.             if (random >= -25 && random <= 25) random *= 3.5
  37.             random = Math.round(random);
  38.             random /= 100;
  39.             let o1 = new Entity({
  40.             x: this.x,
  41.             y: this.y
  42.             })
  43.             o1.define(Class.snowcore);
  44.             o1.team = this.team;
  45.             o1.name = this.name;
  46.           }
  47.  if (this.frag === 'corexplosion') {
  48.             let color = this.color
  49.             let frag = this.frag
  50.             let size = this.SIZE
  51.             var random = ran.randomRange(-100, 100);
  52.             if (random >= -25 && random <= 25) random *= 3.5
  53.             random = Math.round(random);
  54.             random /= 100;
  55.             let o1 = new Entity({
  56.             x: this.x,
  57.             y: this.y
  58.             })
  59.             o1.define(Class.corexplosion);
  60.             o1.team = this.team;
  61.             o1.name = this.name;
  62.           }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement