com.megacrit.cardcrawl.helpers.ScreenShake Java Examples

The following examples show how to use com.megacrit.cardcrawl.helpers.ScreenShake. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GradeChangeShineEffect.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    if (duration / baseDuration < 0.6F && !clang1) {
        playSound.get();
        clang1 = true;
        clank(x - 80.0F * Settings.scale, y + 0.0F * Settings.scale);
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.HIGH, ScreenShake.ShakeDur.SHORT, false);
    }

    if (duration / baseDuration < 0.2F && !clang2) {
        if(playSoundEachClang) {
            playSound.get();
        }
        clang2 = true;
        clank(x + 90.0F * Settings.scale, y - 110.0F * Settings.scale);
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.HIGH, ScreenShake.ShakeDur.SHORT, false);
    }

    duration -= Gdx.graphics.getDeltaTime();
    if (duration < 0.0F) {
        if(playSoundEachClang) {
            playSound.get();
        }
        clank(this.x + 30.0F * Settings.scale, y + 120.0F * Settings.scale);
        isDone = true;
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.HIGH, ScreenShake.ShakeDur.SHORT, false);
    }

}
 
Example #2
Source File: Cull.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
public void doCharSelectScreenSelectEffect() {
    CardCrawlGame.sound.playA("BLOOD_SPLAT", 0.8f);
    CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.LOW, ScreenShake.ShakeDur.SHORT, false);
}
 
Example #3
Source File: DeckOfManyThingsEvent.java    From jorbs-spire-mod with MIT License 4 votes vote down vote up
@Override
protected void buttonEffect(int i) { // This is the event:
    switch (screenNum) {
        case 0: // While you are on screen number 0 (The starting screen)
            switch (i) {
                case 0: // If you press button the first button (Button at index 0), in this case: Inspiration.
                    this.imageEventText.updateBodyText(DESCRIPTIONS[1]); // Update the text of the event
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]); // 1. Change the first button to the [Leave] button
                    this.imageEventText.clearRemainingOptions(); // 2. and remove all others
                    screenNum = 1; // Screen set the screen number to 1. Once we exit the switch (i) statement,
                    // we'll still continue the switch (screenNum) statement. It'll find screen 1 and do it's actions
                    // (in our case, that's the final screen, but you can chain as many as you want like that)

                    AbstractRelic relicToAdd = RelicLibrary.starterList.get(AbstractDungeon.relicRng.random(RelicLibrary.starterList.size() - 1)).makeCopy();
                    // Get a random starting relic

                    AbstractDungeon.getCurrRoom().spawnRelicAndObtain((float)(Settings.WIDTH / 2), (float)(Settings.HEIGHT / 2), relicToAdd);


                    break; // Onto screen 1 we go.
                case 1: // If you press button the second button (Button at index 1), in this case: Deinal

                    CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.MED, ScreenShake.ShakeDur.MED, false);
                    // Shake the screen
                    CardCrawlGame.sound.play("BLUNT_FAST");  // Play a hit sound
                    AbstractDungeon.player.decreaseMaxHealth(healthdamage); // Lose max HP
                    if (CardGroup.getGroupWithoutBottledCards(AbstractDungeon.player.masterDeck.getPurgeableCards()).size() > 0) {
                        // If you have cards you can remove - remove a card
                        AbstractDungeon.gridSelectScreen.open(
                                CardGroup.getGroupWithoutBottledCards(
                                        AbstractDungeon.player.masterDeck.getPurgeableCards()),
                                1, OPTIONS[6], false, false, false, true);
                    }

                    this.imageEventText.updateBodyText(DESCRIPTIONS[2]);
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]);
                    this.imageEventText.clearRemainingOptions();
                    screenNum = 1;

                    // Same as before. A note here is that you can also do
                    // imageEventText.clearAllDialogs();
                    // imageEventText.setDialogOption(OPTIONS[1]);
                    // imageEventText.setDialogOption(OPTIONS[4]);
                    // (etc.)
                    // And that would also just set them into slot 0, 1, 2... in order, just like what we do in the very beginning

                    break; // Onto screen 1 we go.
                case 2: // If you press button the third button (Button at index 2), in this case: Acceptance

                    AbstractCard c = new Apotheosis().makeCopy();
                    AbstractDungeon.effectList.add(new ShowCardAndObtainEffect(c, (float) (Settings.WIDTH / 2), (float) (Settings.HEIGHT / 2)));

                    this.imageEventText.updateBodyText(DESCRIPTIONS[3]);
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]);
                    this.imageEventText.clearRemainingOptions();
                    screenNum = 1;
                    break;
                case 3: // If you press button the fourth button (Button at index 3), in this case: TOUCH
                    imageEventText.loadImage("stsjorbsmodResources/images/events/IdentityCrisisEvent2.png"); // Change the shown image
                    // Other than that, this option doesn't do anything special.
                    this.imageEventText.updateBodyText(DESCRIPTIONS[4]);
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]);
                    this.imageEventText.clearRemainingOptions();
                    screenNum = 1;
                    break;
            }
            break;
        case 1: // Welcome to screenNum = 1;
            switch (i) {
                case 0: // If you press the first (and this should be the only) button,
                    openMap(); // You'll open the map and end the event.
                    break;
            }
            break;
    }
}
 
Example #4
Source File: PlayerDamage.java    From StSLib with MIT License 4 votes vote down vote up
@SpireInsertPatch(
        locator=Locator.class,
        localvars={"damageAmount", "hadBlock"}
)
public static void Insert(AbstractCreature __instance, DamageInfo info, @ByRef int[] damageAmount, @ByRef boolean[] hadBlock)
{
    hadTempHP = false;
    if (damageAmount[0] <= 0) {
        return;
    }

    int temporaryHealth = TempHPField.tempHp.get(__instance);
    if (temporaryHealth > 0) {
        for (AbstractPower power : __instance.powers) {
            if (power instanceof OnLoseTempHpPower) {
                damageAmount[0] = ((OnLoseTempHpPower) power).onLoseTempHp(info, damageAmount[0]);
            }
        }
        if (__instance instanceof AbstractPlayer) {
            for (AbstractRelic relic : ((AbstractPlayer) __instance).relics) {
                if (relic instanceof OnLoseTempHpRelic) {
                    damageAmount[0] = ((OnLoseTempHpRelic) relic).onLoseTempHp(info, damageAmount[0]);
                }
            }
        }

        hadTempHP = true;
        for (int i = 0; i < 18; ++i) {
            AbstractDungeon.effectsQueue.add(new DamageImpactLineEffect(__instance.hb.cX, __instance.hb.cY));
        }
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.MED, ScreenShake.ShakeDur.SHORT, false);
        if (temporaryHealth >= damageAmount[0]) {
            temporaryHealth -= damageAmount[0];
            AbstractDungeon.effectsQueue.add(new TempDamageNumberEffect(__instance, __instance.hb.cX, __instance.hb.cY, damageAmount[0]));
            //AbstractDungeon.effectList.add(new BlockedWordEffect(__instance, __instance.hb.cX, __instance.hb.cY, "Absorbed"));
            damageAmount[0] = 0;
        } else {
            damageAmount[0] -= temporaryHealth;
            AbstractDungeon.effectsQueue.add(new TempDamageNumberEffect(__instance, __instance.hb.cX, __instance.hb.cY, temporaryHealth));
            temporaryHealth = 0;
        }

        TempHPField.tempHp.set(__instance, temporaryHealth);
    }
}
 
Example #5
Source File: TheTranquil.java    From FruityMod-StS with MIT License 4 votes vote down vote up
@Override
public void doCharSelectScreenSelectEffect() {
    CardCrawlGame.sound.playA("UNLOCK_PING", MathUtils.random(-0.2F, 0.2F));
    CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.LOW, ScreenShake.ShakeDur.SHORT,
            false);
}
 
Example #6
Source File: TheSeeker.java    From FruityMod-StS with MIT License 4 votes vote down vote up
@Override
public void doCharSelectScreenSelectEffect() {
    CardCrawlGame.sound.playA("UNLOCK_PING", MathUtils.random(-0.2F, 0.2F));
    CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.LOW, ScreenShake.ShakeDur.SHORT,
            false);
}
 
Example #7
Source File: TheDefault.java    From StS-DefaultModBase with MIT License 4 votes vote down vote up
@Override
public void doCharSelectScreenSelectEffect() {
    CardCrawlGame.sound.playA("ATTACK_DAGGER_1", 1.25f); // Sound Effect
    CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.LOW, ScreenShake.ShakeDur.SHORT,
            false); // Screen Effect
}
 
Example #8
Source File: IdentityCrisisEvent.java    From StS-DefaultModBase with MIT License 4 votes vote down vote up
@Override
protected void buttonEffect(int i) { // This is the event:
    switch (screenNum) {
        case 0: // While you are on screen number 0 (The starting screen)
            switch (i) {
                case 0: // If you press button the first button (Button at index 0), in this case: Inspiration.
                    this.imageEventText.updateBodyText(DESCRIPTIONS[1]); // Update the text of the event
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]); // 1. Change the first button to the [Leave] button
                    this.imageEventText.clearRemainingOptions(); // 2. and remove all others
                    screenNum = 1; // Screen set the screen number to 1. Once we exit the switch (i) statement,
                    // we'll still continue the switch (screenNum) statement. It'll find screen 1 and do it's actions
                    // (in our case, that's the final screen, but you can chain as many as you want like that)

                    AbstractRelic relicToAdd = RelicLibrary.starterList.get(AbstractDungeon.relicRng.random(RelicLibrary.starterList.size() - 1)).makeCopy();
                    // Get a random starting relic

                    AbstractDungeon.getCurrRoom().spawnRelicAndObtain((float)(Settings.WIDTH / 2), (float)(Settings.HEIGHT / 2), relicToAdd);


                    break; // Onto screen 1 we go.
                case 1: // If you press button the second button (Button at index 1), in this case: Deinal

                    CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.MED, ScreenShake.ShakeDur.MED, false);
                    // Shake the screen
                    CardCrawlGame.sound.play("BLUNT_FAST");  // Play a hit sound
                    AbstractDungeon.player.decreaseMaxHealth(healthdamage); // Lose max HP
                    if (CardGroup.getGroupWithoutBottledCards(AbstractDungeon.player.masterDeck.getPurgeableCards()).size() > 0) {
                        // If you have cards you can remove - remove a card
                        AbstractDungeon.gridSelectScreen.open(
                                CardGroup.getGroupWithoutBottledCards(
                                        AbstractDungeon.player.masterDeck.getPurgeableCards()),
                                1, OPTIONS[6], false, false, false, true);
                    }

                    this.imageEventText.updateBodyText(DESCRIPTIONS[2]);
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]);
                    this.imageEventText.clearRemainingOptions();
                    screenNum = 1;

                    // Same as before. A note here is that you can also do
                    // imageEventText.clearAllDialogs();
                    // imageEventText.setDialogOption(OPTIONS[1]);
                    // imageEventText.setDialogOption(OPTIONS[4]);
                    // (etc.)
                    // And that would also just set them into slot 0, 1, 2... in order, just like what we do in the very beginning

                    break; // Onto screen 1 we go.
                case 2: // If you press button the third button (Button at index 2), in this case: Acceptance

                    AbstractCard c = new Apotheosis().makeCopy();
                    AbstractDungeon.effectList.add(new ShowCardAndObtainEffect(c, (float) (Settings.WIDTH / 2), (float) (Settings.HEIGHT / 2)));

                    this.imageEventText.updateBodyText(DESCRIPTIONS[3]);
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]);
                    this.imageEventText.clearRemainingOptions();
                    screenNum = 1;
                    break;
                case 3: // If you press button the fourth button (Button at index 3), in this case: TOUCH
                    imageEventText.loadImage("theDefaultResources/images/events/IdentityCrisisEvent2.png"); // Change the shown image
                    // Other than that, this option doesn't do anything special.
                    this.imageEventText.updateBodyText(DESCRIPTIONS[4]);
                    this.imageEventText.updateDialogOption(0, OPTIONS[5]);
                    this.imageEventText.clearRemainingOptions();
                    screenNum = 1;
                    break;
            }
            break;
        case 1: // Welcome to screenNum = 1;
            switch (i) {
                case 0: // If you press the first (and this should be the only) button,
                    openMap(); // You'll open the map and end the event.
                    break;
            }
            break;
    }
}