示例#1
0
  private static Animation getAnimation(Bullet bullet) {
    if (bullet.getType() instanceof ThBullet) {
      Animation ani =
          new ThBullet(
                  ThBulletType.ORB_MEDIUM,
                  ((ThBullet) bullet.getType()).getBulletColor().getBreakAnimationColor())
              .getAnimation();

      return ani;
    } else {
      Animation ani =
          new ThBullet(
                  ThBulletType.ORB_MEDIUM,
                  ThBulletColor.getClosest(
                      ThBulletColor.POSSIBLE_SPAWN, bullet.getType().getEffectColor()))
              .getAnimation();

      return ani;
    }
  }
示例#2
0
  public TouhouSpawnAnimation(Bullet bullet) {
    super(bullet, getAnimation(bullet), Duration.seconds(0.25f));

    setBlendFunc(bullet.getBlendFuncSrc(), bullet.getBlendFuncDst());
  }
示例#3
0
    @Override
    public void tick(int tick, J2hGame game, final Ringo boss) {
      final Player player = game.getPlayer();

      if (tick == 60) {
        boss.playSpecial(true);
        BossUtil.charge(boss, boss.getAuraColor(), false);

        TouhouSounds.Enemy.ACTIVATE_3.play();
      }

      if (tick == 100) boss.playSpecial(false);

      if (tick < 100) {
        return;
      }

      tick -= 100;

      if (tick % 50 == 0) {
        for (final boolean bool : new boolean[] {true, false}) {
          Bullet bullet = ThBullet.makeBullet(ThBulletType.BALL_BIG, ThBulletColor.PURPLE, boss);
          bullet.setScale(0.2f, 4f);

          final float finalAngle = MathUtil.getAngle(bullet, player) + ((bool ? 1f : -1f) * 60f);
          final float finalRad = (float) Math.toRadians(finalAngle);

          bullet.setDirectionDeg(finalAngle, 300f);
          bullet.setRotationFromVelocity();
          //					bullet.getSpawnAnimation().setAlpha(-0.5f);
          //					bullet.getSpawnAnimation().setTime(60);
          //					bullet.getSpawnAnimation().setAddedScale(0f);
          bullet.useSpawnAnimation(false);
          bullet.setGlowing();

          bullet.addEffect(
              new Plugin<Bullet>() {
                private ZIndexHelper indexer = new ZIndexHelper();

                @Override
                public void update(Bullet object, long tick) {
                  if (object.getTicksAlive() < 12) return;

                  tick = object.getTicksAlive() - 12;

                  final float mul = -(1f * (Math.min(object.getTicksAlive() - 30, 200f) / 200f));

                  if (tick % 6 == 0 && tick % (10 * 6) <= (4 * 6)) {
                    TouhouSounds.Enemy.RELEASE_1.play(0.1f);

                    final int returnTime = 200;

                    final Bullet bullet =
                        new Bullet(
                            new ThBullet(ThBulletType.BALL_BIG, ThBulletColor.WHITE),
                            (float) (object.getX() - (Math.cos(finalRad) * 140)),
                            (float) (object.getY() - (Math.sin(finalRad) * 140))) {
                          @Override
                          public void checkCollision() {
                            if (getTicksAlive() > returnTime) {
                              return;
                            }

                            super.checkCollision();
                          };
                        };

                    //								bullet.useSpawnAnimation(false);

                    bullet.addEffect(
                        new Plugin<Bullet>() {
                          @Override
                          public void update(Bullet object, long tick) {
                            float speed = 300f + -200f * (mul);

                            if (object.getTicksAlive() < 40) {
                              speed = 0f;
                            }

                            if (object.getTicksAlive() > returnTime) {
                              Position mouth = new Position(boss).add(new Position(0, 35f));

                              bullet.setDirectionDeg(MathUtil.getAngle(bullet, mouth), 500f);

                              double dist = MathUtil.getDistance(bullet, mouth);
                              float mul = (float) (dist < 20 ? (dist / 20f) : 1f);

                              bullet.setScale(0.4f * mul);
                              bullet.getCurrentSprite().setAlpha(0.5f);
                              bullet.useDeathAnimation(false);
                              bullet.useSpawnAnimation(false);

                              if (dist < 2) {
                                game.delete(object);
                              }
                            } else {
                              bullet.setDirectionDeg(
                                  finalAngle
                                      + ((bool ? 0.12f : -0.12f) * (object.getTicksAlive()))
                                      + (((bool ? -90f : 90f))),
                                  speed);
                            }
                          }
                        });

                    indexer.index(bullet);

                    game.spawn(bullet);
                  }
                }
              });

          game.spawn(bullet);
        }
      }

      if (tick % 14 == 0) {
        Bullet bullet = ThBullet.makeBullet(ThBulletType.BALL_BIG, ThBulletColor.BLUE, boss);

        bullet.setDirectionDeg(MathUtil.getAngle(bullet, player), 400f);
        bullet.setGlowing();

        game.spawn(bullet);
      }

      if (tick % 200 == 0) {
        boss.getPathing().path(new SimpleTouhouBossPath(boss));
      }
    }
示例#4
0
    @Override
    public void tick(int tick, J2hGame game, Ringo boss) {
      final Player player = game.getPlayer();

      if (tick == 100) {
        boss.playSpecial(true);

        BossUtil.chargeExplosion(boss, boss.getAuraColor());
      }

      if (tick < 130) {
        return;
      }

      final int COLOR_PERIOD = 400;

      tick -= 130;

      if (tick % 8 == 0) {
        TouhouSounds.Enemy.BULLET_1.play(0.3f);
      }

      if (tick % 6 == 0) {
        int amount = 30;

        for (int i = 0; i < amount; i++) {
          float angle = ((float) i / (float) amount) * 360;

          double mul = RNG.multiplierMirror(1000, tick);

          angle += (Math.sin(RNG.multiplier(200, tick) * Math.PI) * (50 + (200 * mul)));

          Bullet bullet =
              new Bullet(
                  new ThBullet(
                      ThBulletType.BALL_2,
                      RNG.booleanMultiplier(COLOR_PERIOD, tick)
                          ? ThBulletColor.BLUE
                          : ThBulletColor.PURPLE),
                  boss.getX(),
                  boss.getY());

          final float speed = 400f;

          bullet.setDirectionDeg(angle, speed * 2f);
          bullet.setZIndex(bullet.getZIndex() + i);

          bullet.addEffect(
              new Plugin<Bullet>() {
                @Override
                public void update(Bullet object, long tick) {
                  if (object.getTicksAlive() == 15) {
                    object.setDirectionDeg(object.getVelocityRotationDeg(), speed);
                  }

                  object.getCurrentSprite().rotate(2f);

                  float mul = 1f; // Math.min(1, object.getTicksAlive() / 10f);

                  object.setScale(mul);
                }
              });

          bullet.useSpawnAnimation(false);
          bullet.setGlowing();

          game.spawn(bullet);
        }
      }

      if (tick % 10 == 0) {
        int directions = 6;

        for (int i = 0; i < directions; i++) {
          float angle = ((float) i / (float) directions) * 360;

          ArrayList<Bullet> circle = circle(boss.getX(), boss.getY(), 2, 20);

          for (Bullet bullet : circle) {
            bullet.setDirectionDeg((float) (angle + (RNG.multiplier(600, tick)) * 360f), 300f);
            bullet.setBullet(
                ThBullet.make(
                    ThBulletType.DOT_SMALL_MOON,
                    RNG.booleanMultiplier(COLOR_PERIOD, tick)
                        ? ThBulletColor.BLUE
                        : ThBulletColor.PURPLE));
            bullet.setGlowing();
          }
        }
      }
    }