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;
player.setAnimation(CharacterSprite.AnimationTypes.Attack);
mob.setAnimation(CharacterSprite.AnimationTypes.Attack);
SoundSystem.instance.play(SoundEffectType.Block, false);
Gdx.input.vibrate(50);
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
DuelScene duelScene = ((DuelScene) SceneType.DuelScene.instance);
FThreads.invokeInEdtNowOrLater(() -> {
if (!isLoadingMatch) {
isLoadingMatch = true;
Forge.setTransitionScreen(new TransitionScreen(() -> {
duelScene.initDuels(player, mob);
Forge.clearTransitionScreen();
startPause(0.3f, () -> {
if(isInMap && effect != null) duelScene.setDungeonEffect(effect);
Forge.switchScene(SceneType.DuelScene.instance);
});
}, ScreenUtils.getFrameBufferTexture(), true, false));
}
startPause(0.8f, () -> {
Forge.setCursor(null, Forge.magnifyToggle ? "1" : "2");
SoundSystem.instance.play(SoundEffectType.ManaBurn, false);
DuelScene duelScene = ((DuelScene) SceneType.DuelScene.instance);
FThreads.invokeInEdtNowOrLater(() -> {
if (!isLoadingMatch) {
isLoadingMatch = true;
Forge.setTransitionScreen(new TransitionScreen(() -> {
duelScene.initDuels(player, mob);
Forge.clearTransitionScreen();
startPause(0.3f, () -> {
if(isInMap && effect != null) duelScene.setDungeonEffect(effect);
Forge.switchScene(SceneType.DuelScene.instance);
});
}, ScreenUtils.getFrameBufferTexture(), true, false));
}
});
});
}

View File

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