add delay to see attack animation

- add short delay to see player and mob attack animation before the duel starts
This commit is contained in:
Anthony Calosa
2022-05-26 13:11:15 +08:00
parent e0a16981ff
commit 644b1c051a
2 changed files with 32 additions and 26 deletions

View File

@@ -662,22 +662,25 @@ public class MapStage extends GameStage {
currentMob = mob; currentMob = mob;
player.setAnimation(CharacterSprite.AnimationTypes.Attack); player.setAnimation(CharacterSprite.AnimationTypes.Attack);
mob.setAnimation(CharacterSprite.AnimationTypes.Attack); mob.setAnimation(CharacterSprite.AnimationTypes.Attack);
SoundSystem.instance.play(SoundEffectType.Block, false);
Gdx.input.vibrate(50); Gdx.input.vibrate(50);
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2"); startPause(0.8f, () -> {
SoundSystem.instance.play(SoundEffectType.ManaBurn, false); Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
DuelScene duelScene = ((DuelScene) SceneType.DuelScene.instance); SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
FThreads.invokeInEdtNowOrLater(() -> { DuelScene duelScene = ((DuelScene) SceneType.DuelScene.instance);
if (!isLoadingMatch) { FThreads.invokeInEdtNowOrLater(() -> {
isLoadingMatch = true; if (!isLoadingMatch) {
Forge.setTransitionScreen(new TransitionScreen(() -> { isLoadingMatch = true;
duelScene.initDuels(player, mob); Forge.setTransitionScreen(new TransitionScreen(() -> {
Forge.clearTransitionScreen(); duelScene.initDuels(player, mob);
startPause(0.3f, () -> { Forge.clearTransitionScreen();
if(isInMap && effect != null) duelScene.setDungeonEffect(effect); startPause(0.3f, () -> {
Forge.switchScene(SceneType.DuelScene.instance); if(isInMap && effect != null) duelScene.setDungeonEffect(effect);
}); Forge.switchScene(SceneType.DuelScene.instance);
}, ScreenUtils.getFrameBufferTexture(), true, false)); });
} }, ScreenUtils.getFrameBufferTexture(), true, false));
}
});
}); });
} }

View File

@@ -84,18 +84,21 @@ public class WorldStage extends GameStage implements SaveFileContent {
if (player.collideWith(mob)) { if (player.collideWith(mob)) {
player.setAnimation(CharacterSprite.AnimationTypes.Attack); player.setAnimation(CharacterSprite.AnimationTypes.Attack);
mob.setAnimation(CharacterSprite.AnimationTypes.Attack); mob.setAnimation(CharacterSprite.AnimationTypes.Attack);
SoundSystem.instance.play(SoundEffectType.Block, false);
Gdx.input.vibrate(50); Gdx.input.vibrate(50);
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2"); startPause(0.8f, () -> {
SoundSystem.instance.play(SoundEffectType.ManaBurn, false); Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
DuelScene duelScene = ((DuelScene) SceneType.DuelScene.instance); SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
FThreads.invokeInEdtNowOrLater(() -> { DuelScene duelScene = ((DuelScene) SceneType.DuelScene.instance);
Forge.setTransitionScreen(new TransitionScreen(() -> { FThreads.invokeInEdtNowOrLater(() -> {
duelScene.initDuels(player, mob); Forge.setTransitionScreen(new TransitionScreen(() -> {
Forge.clearTransitionScreen(); duelScene.initDuels(player, mob);
startPause(0.3f, () -> Forge.switchScene(SceneType.DuelScene.instance)); Forge.clearTransitionScreen();
}, ScreenUtils.getFrameBufferTexture(), true, false)); startPause(0.3f, () -> Forge.switchScene(SceneType.DuelScene.instance));
currentMob = mob; }, ScreenUtils.getFrameBufferTexture(), true, false));
WorldSave.getCurrentSave().autoSave(); currentMob = mob;
WorldSave.getCurrentSave().autoSave();
});
}); });
break; break;
} }