@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)); } }