SHARE
TWEET

h

a guest Dec 31st, 2016 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shmup.util.task([], function* () {
  2.   var counter = Shmup.util.count({
  3.     min: 0,
  4.     max: 1,
  5.     change: 1,
  6.     reset: true,
  7.   });
  8.   var randomOne = Math.random() * 50;
  9.   var randomTwo = Math.random() * 50;
  10.   for (var i = 0; i < 90; i ++) {
  11.     for (var j = 1; j < 6; j ++) {
  12.       Shmup.projectile.bullet.create({
  13.         position: {
  14.           x: Shmup.advanced.data().scene.size.x / 2,
  15.           y: Shmup.advanced.data().scene.size.y / 3.75,
  16.         },
  17.         angle: Math.abs(Shmup.math.angle.degree.to.radian((i * randomOne + j * randomTwo))),
  18.         speed: 2,
  19.         data: {
  20.           graphic: (function() {
  21.             var bulletImg = new PIXI.Sprite(spritesheet);
  22.             bulletImg.anchor.set(0.5, 0.5);
  23.             stage.addChild(bulletImg);
  24.             return bulletImg;
  25.           })(),
  26.         },
  27.         update: function(projectile) {
  28.           projectile.data.graphic.position.set(projectile.position.x, projectile.position.y);
  29.           projectile.data.graphic.rotation = -projectile.angle - Math.PI;
  30.           if (Shmup.util.out(0, projectile.position)) {
  31.             stage.removeChild(projectile.data.graphic);
  32.             Shmup.projectile.bullet.vanish(projectile);
  33.           }
  34.         },
  35.       });
  36.     }
  37.     yield* Shmup.util.wait(2, function() {
  38.       if (counter() >= 1) {
  39.         return false;
  40.       } else {
  41.         return true;
  42.       }
  43.     });
  44.   }
  45. }, {reset: false, update: true});
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top