@Override public void onDraw() { super.onDraw(); J2hGame game = Game.getGame(); Color color = Color.WHITE; topFont.setColor(color); botFont.setColor(color); String text = "Developer Menu"; TextBounds bounds = topFont.getBounds(text); topFont.setColor(Color.BLACK); topFont.draw(game.batch, text, Game.getGame().getWidth() / 2 - bounds.width / 2, 900); topFont.setColor(Color.WHITE); topFont.draw(game.batch, text, Game.getGame().getWidth() / 2 - bounds.width / 2 - 3, 903); text = "-----"; bounds = botFont.getBounds(text); botFont.setColor(Color.BLACK); botFont.draw(game.batch, text, Game.getGame().getWidth() / 2 - bounds.width / 2, 820); botFont.setColor(Color.WHITE); botFont.draw(game.batch, text, Game.getGame().getWidth() / 2 - bounds.width / 2 - 3, 823); }
public void writeLine(String text, BitmapFont font, float x, float y) { TextBounds bounds = font.getBounds(text); font.setColor(Color.BLACK); font.draw(Game.getGame().batch, text, x - bounds.width / 2 + 3, y); font.setColor(Color.WHITE); font.draw(Game.getGame().batch, text, x - bounds.width / 2, y + 3); }
@Override public void runScheme() { final J2hGame g = Game.getGame(); Game.getGame() .addTaskGame( new Runnable() { @Override public void run() { startSpellcard(); } }, 5); }
public void addButton(String name, final Runnable stageRunner) { TextBounds bound = botFont.getBounds(name); final DeveloperMenu screen = this; getButtonManager() .addButton( new ShadowedTextButton( Game.getGame().getWidth() / 2 - bound.width / 2, START_Y - Y_ADD * index, botFont, name, new Runnable() { @Override public void run() { TouhouSounds.Hud.OK.play(); Game.getGame().delete(screen); for (StageObject obj : Game.getGame().getStageObjects()) { obj.onDelete(); } Game.getGame().getSpellcards().clear(); Game.getGame().getStageObjects().clear(); Game.getGame().clearObjects(); ((AllStarGame) Game.getGame()).score = 0; ((AllStarGame) Game.getGame()).deaths = 0; Game.getGame() .spawn( Marisa.newInstance( Game.getGame().getWidth() / 2, Game.getGame().getHeight() / 2)); Game.getGame().setOutOfGame(false); Game.getGame().setPaused(false); stageRunner.run(); TouhouSounds.Hud.OK.play(); Menu parent = screen.getParent(); while (parent != null) { Game.getGame().delete(parent); parent = parent.getParent(); } } }) { { setFont(botFont); } }); index++; }
@Override public void tick(int tick) { final J2hGame game = Game.getGame(); final Player player = game.getPlayer(); final Boss boss = (Boss) getOwner(); if (tick % 500 == 0) { Texture sparkTexture = Loader.texture(Gdx.files.internal("enemy/sleepyyuuka/laser.png")); sparkTexture.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Nearest); HitboxSprite sprite = new HitboxSprite(new Sprite(sparkTexture)); sprite.setScale(4f, 4f); sprite.setHitbox( HitboxUtil.makeHitboxFromSprite( new TextureRegion(sparkTexture), HitboxUtil.StandardBulletSpecification.get())); sprite.setOrigin(0, sprite.getHeight() / 2f); sprite.getHitbox().setOrigin(0, sprite.getHitbox().getBoundingRectangle().height / 2f); sprite.getHitbox().rotate(180f); sprite.setHitboxScaleOffsetModifierX(1f); sprite.setHitboxScaleOffsetModifierY(0.7f); Animation ani = new Animation(1f, sprite); Spark spark = new Spark(ani, boss.getX(), boss.getY()) { @Override public void onUpdate(long tick) { super.onUpdate(tick); if (getTicksAlive() > 400) Game.getGame().delete(this); setRotationDeg(getTicksAlive()); } }; Game.getGame().spawn(spark); } }
{ final DeveloperMenu screen = this; final J2hGame game = Game.getGame(); final float startX = game.getMinX() + (game.getMaxX() - game.getMinX()) / 2; final float startY = Game.getGame().getHeight() - 150; addButton( "3D Background tester", new Runnable() { @Override public void run() { final Runnable run = new Runnable() { @Override public void run() { Game.getGame().spawn(new MoonBG()); } }; Getter getter = new Getter<TestScheme>() { @Override public TestScheme get() { return new TestScheme() { @Override public GameFlowScheme getRestartInstance() { return get(); } @Override public void startSpellcard() { run.run(); } }; } }; Game.getGame().setScheme((GameFlowScheme) getter.get()); Game.getGame().getScheme().start(); } }); final Getter<SpecialFlowScheme> getter = new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { DialogueFlowScheme holder = new DialogueFlowScheme( new Getter<FaceToFaceDialogue>() { @Override public FaceToFaceDialogue get() { final DDCDialogueTextBalloon balloon = new DDCDialogueTextBalloon(); final DialogueParticipant left = new MarisaDP(); final DialogueParticipant right = new MarisaDP(); final FaceToFaceDialogue d = new FaceToFaceDialogue(balloon, left, right); String ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a luctus risus, vel fringilla metus. Nunc commodo dui sed lectus viverra, in tincidunt felis tincidunt. Mauris metus ex, bibendum et nulla eu, pharetra iaculis arcu. Curabitur at malesuada libero, non bibendum tellus. Maecenas non luctus est. Suspendisse id lectus nisi. Donec pharetra orci ultrices, aliquam magna quis, iaculis lorem. Sed imperdiet feugiat pretium. In fringilla diam magna, vulputate dignissim lectus hendrerit eget. Suspendisse potenti. Nulla sit amet nisi vitae mi pharetra volutpat. Sed erat quam, rhoncus id elit id, sollicitudin laoreet purus. Donec sodales eleifend ex, a interdum elit consequat non. Maecenas nibh tellus, commodo sed risus eu, imperdiet commodo dui. Nam id mollis leo, vitae congue eros. Phasellus eget libero at eros laoreet commodo nec in eros."; String[] array = ipsum.split("\\. "); DialogueMaker m = new DialogueMaker(left); m.text("Hey, I'm about to say something really long and boring") .enterStage() .nextDialogue(right); m.text("k, ignored you anyways.") .face(MarisaDPFace.SIGH) .enterStage() .nextDialogue(left); for (int i = 0; i < array.length - 2; i += 2) { String str = array[i] + "\n" + array[i + 1]; m.text(str).face(MarisaDPFace.CONFUSED).nextDialogue(right); String[] replies = { "Very nice...", "Alright.", "Interesting...", "Good for you.", "Uhu", "Sooooo innnnteerreeessstttinnggg... -ZZZZ-" }; m.text(replies[(int) (Math.random() * replies.length)]) .face(MarisaDPFace.SIGH) .nextDialogue(left); } m.text("Remember to take it easy!") .face(MarisaDPFace.YUKKURI) .speechBubbleType(DDCBalloonType.SCREAM) .nextDialogue(right); m.text("What was that!?").face(MarisaDPFace.IDIOCY); d.addDialogue(m.getDialogue()); return d; } }); return holder; } }; addButton( "Simple Dialogue between 2xMarisa", new Runnable() { @Override public void run() { Getter<GameFlowScheme> schemeGetter = new Getter<GameFlowScheme>() { @Override public GameFlowScheme get() { return new GameFlowScheme() { @Override public GameFlowScheme getRestartInstance() { return get(); } @Override public void runScheme() { getter.get().executeFight(this); } }; } }; Game.getGame().setScheme(schemeGetter.get()); Game.getGame().getScheme().start(); } }); TextBounds bound = botFont.getBounds("Exit"); getButtonManager() .addButton( new ShadowedTextButton( Game.getGame().getWidth() / 2 - bound.width / 2, 100, botFont, "Exit", new Runnable() { @Override public void run() { TouhouSounds.Hud.OK.play(); Game.getGame().delete(screen); } }) { { setFont(botFont); } }); setZIndex(J2hGame.GUI_Z_ORDER + 2); }
static { final J2hGame game = Game.getGame(); final float startX = game.getMinX() + (game.getMaxX() - game.getMinX()) / 2; final float startY = Game.getGame().getHeight() - 150; final float startHP = 100f; int day = 1; EnvironmentType type = EnvironmentType.MIST_LAKE; // Day 1 { // Mist lake addCharacter( day, type, "Wakasagihime", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Wakasagihime boss = new Wakasagihime(startHP, startX, startY); return boss; } }); addCharacter( day, type, "Cirno", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Cirno boss = new Cirno(startHP, startX, startY); return boss; } }); // Letty // Three Faries // Hong Meiling type = EnvironmentType.DREAM_DIM; // Dream Dimension: (People who can't use danmaku can here!) // Maribel & Renko // Heida no Akyu // Rinnosuke addCharacter( day, type, Doremy.FULL_NAME, new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Doremy boss = new Doremy(startHP, startX, startY); return boss; } }); } day++; type = EnvironmentType.BAMBOO; // Day 2 { // Bamboo forest // Rumia // Wriggle // Mystia // Keine addCharacter( day, type, "Kagerou Imaizumi", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Kagerou boss = new Kagerou(startHP, startX, startY); return boss; } }); // Tewi addCharacter( day, type, "Fujiwara No Mokou", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { return new Mokou(startHP, startX, startY); } }); } day++; type = EnvironmentType.UNDERGROUND_CITY; // Day 3 { // Underground City: // Kisume // Yamame // Parsee // Satori // Yuugi // Rin // Utusho // Suika // Koishi } day++; type = EnvironmentType.YOUKAI_MOUNTAIN; // Day 4 { // Youkai Mountain: // Aki Sisters // Hina // Nitori // Momiji // Hatate // Aya // Sanae // Kanako & Suwako } day++; type = EnvironmentType.ABOVE_THE_CLOUDS; // Day 5 { // Above the clouds: addCharacter( day, type, "Seiran", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Seiran boss = new Seiran(startHP, startX, startY); return boss; } }); // Kogasa // Nazrin // Lily White // Ichirin // Murusa // Prismriver Sisters addCharacter( day, type, Iku.FULL_NAME, new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Iku boss = new Iku(startHP, startX, startY); return boss; } }); // Nue addCharacter( day, type, Tenshi.FULL_NAME, new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Tenshi boss = new Tenshi(startHP, startX, startY); return boss; } }); } day++; type = EnvironmentType.CEMETRY_ROAD; // Day 6 { // Cemetry road: // Kyouko addCharacter( day, type, "Sekibanki", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { return new Sekibanki(startHP, startX, startY); } }); // Seiga & Zombie // Tojiko // Youmu // Monobe no Futo // Yuyuko // Miko } day++; type = EnvironmentType.THUNDER_CLOUDS; // Day 7 { // Thundering clouds: addSpecial( day, type, "Yatsuhashi & Benben Tsukumo", new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { final TsukumoGeneral boss = new TsukumoGeneral(); return boss; } }); addCharacter( day, type, "Seija Kijin", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Seija boss = Seija.newInstance(startX, startY); return boss; } }); addCharacter( day, type, "Sukuna Shinmyoumaru", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Sukuna boss = new Sukuna(startHP, startX, startY); return boss; } }); addCharacter( day, type, "Raiko Horikawa", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Raiko boss = Raiko.newInstance(startX, startY); return boss; } }); type = EnvironmentType.MOON; // The Moon: addCharacter( day, type, "Ringo", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Ringo boss = new Ringo(startHP, startX, startY); return boss; } }); // Rei'sen (Reisen 2) // Reisen // Watatsuki's // Eirin // Kaguya } day++; type = EnvironmentType.MAKAI; // Day 8 { addSpecial( day, EnvironmentType.MAKAI_STAGE, "Stage", new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { final MakaiStage stage = new MakaiStage(); return stage; } }); addSpecial( day, type, "Mai & Yuki", new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { final MaiYukiGeneral boss = new MaiYukiGeneral(startX, startY); return boss; } }); addCharacter( day, type, "Shou Toramaru", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Shou shou = Shou.newInstance(startX, startY); return shou; } }); addCharacter( day, type, "Yumeko", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Yumeko yumeko = Yumeko.newInstance(startX, startY); return yumeko; } }); addSpecial( day, type, "Alice Margatroid", new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { final AliceGeneral boss = new AliceGeneral(startX, startY); return boss; } }); addCharacter( day, type, "Byakuren Hijiri", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Byakuren byakuren = Byakuren.newInstance(startX, startY); return byakuren; } }); addSpecial(day, type, "Dialogue", new Day7Dialogue()); addCharacter( day, type, "Shinki", new Getter<AllStarBoss>() { @Override public AllStarBoss get() { final Shinki shinki = Shinki.newInstance(startX, startY, false); return shinki; } }); addSpecial( day, type, "Gengetsu & Mugetsu", new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { final GetsusGeneral boss = new GetsusGeneral(); return boss; } }); type = EnvironmentType.SCARLET_DEVIL_MANSION; // SDM: // Patchouli // Sakuya // Remilia & Flandre } day++; type = EnvironmentType.FLOWER_FIELD; // Day 9 { // Flower field: // Medicine addSpecial( day, type, "Yuuka Kazami", new Getter<SpecialFlowScheme>() { @Override public SpecialFlowScheme get() { final YuukaGeneral boss = new YuukaGeneral(startX, startY); return boss; } }); // Komachi // Kasen Ibara // Chiyuri // Futatsuiwa // addCharacter(day, type, Yumemi.FULL_NAME, new Getter<AllStarBoss>() // { // @Override // public AllStarBoss get() // { // final Yumemi yumemi = new Yumemi(100f, startX, startY); // // return yumemi; // } // }); // Shiki Eiki } day++; type = EnvironmentType.HAKURAI; // Day 10 { // Hakurai Shrine/Border: // Ran & Chen // Sariel // Konngara // Marisa // Reimu // Yukari // Mima } }
@Override public void executeFight(final AllStarStageScheme scheme) { final J2hGame g = Game.getGame(); final Ringo boss = this; final SaveableObject<CircleHealthBar> bar = new SaveableObject<CircleHealthBar>(); Game.getGame() .addTaskGame( new Runnable() { @Override public void run() { BossUtil.cloudEntrance( boss, AllStarUtil.from255RGB(255, 183, 0), AllStarUtil.from255RGB(255, 232, 0), 60); g.addTaskGame( new Runnable() { @Override public void run() { bar.setObject(new CircleHealthBar(boss)); g.spawn(boss); g.spawn(bar.getObject()); bar.getObject().addSplit(0.8f); AllStarUtil.introduce(boss); boss.healUp(); BossUtil.addBossEffects(boss, boss.getAuraColor(), boss.getBgAuraColor()); Game.getGame().startSpellCard(new NonSpell(boss)); } }, 60); } }, 1); scheme.wait( new WaitConditioner() { @Override public boolean returnTrueToWait() { return !boss.isOnStage(); } }); SchemeUtil.waitForDeath(scheme, boss); bar.getObject().split(); boss.setHealth(boss.getMaxHealth()); Game.getGame() .addTaskGame( new Runnable() { @Override public void run() { boss.playSpecial(false); game.clear(ClearType.ALL); backgroundSpawner.set(scheme.getBossAura()); AllStarUtil.presentSpellCard(boss, SPELLCARD_NAME); final Spell card = new Spell(boss); Game.getGame().startSpellCard(card); BossUtil.spellcardCircle(boss, card, scheme.getBossAura()); } }, 1); SchemeUtil.waitForDeath(scheme, boss); Game.getGame() .addTaskGame( new Runnable() { @Override public void run() { Game.getGame().clearCircle(800f, boss, ClearType.ALL); } }, 1); scheme.waitTicks(2); boss.playSpecial(false); SchemeUtil.deathAnimation(scheme, boss, boss.getAuraColor()); Game.getGame() .addTaskGame( new Runnable() { @Override public void run() { ObjectUtil.deathAnimation(boss); Game.getGame().delete(boss); Game.getGame().clear(ClearType.ALL); } }, 5); scheme.waitTicks(10); // Prevent concurrency issues. }