Commit d1fd5f89 authored by 18손재민's avatar 18손재민

뇌 무게가 찰 시 뇌가 붉게 깜빡 거리며 사망 시 UI가 2초 뒤에 나타남

parent 959a2057
......@@ -346,7 +346,9 @@ socket.on('defeat', function(msg) // object player
if(msg.id == RoomData.myself.id)
{
RoomData.myself = RoomData.players[msg.index];
backToMenu(false);
setTimeout(() => {
gameEndMenu(true);
}, 2000);
}
});
socket.on('gameEnd', function(msg) // object player
......@@ -355,7 +357,9 @@ socket.on('gameEnd', function(msg) // object player
if(msg.id == RoomData.myself.id)
{
RoomData.myself.rank = 1;
backToMenu(true);
setTimeout(() => {
gameEndMenu(true);
}, 2000);
}
});
......@@ -378,8 +382,11 @@ socket.on('userDisconnect', function(msg) // {num index , num id, str nickname}
RoomData.aliveCount--;
});
var backToMenu = function(isWin)
var gameEndMenu = function(isWin)
{
WordSpace.isGameOver = true;
ScenesData.gameScene.warningImage.destroy();
ScenesData.gameScene.warningTween.remove();
let earnedMoney = 0;
if(isWin) earnedMoney += 20;
earnedMoney += RoomData.myself.killCount * 3;
......
......@@ -2,7 +2,7 @@ var ResourceLoader = ResourceLoader || {};
ResourceLoader.loadBackGround = function(scene)
{
scene.load.image('brain', 'assets/image/background/brain.png');
scene.load.image('weightWarning', 'assets/image/background/weightWarning.png');
scene.load.image('baseBackground', 'assets/image/background/yellowBack.png');
scene.load.image('gameBackground', 'assets/image/background/background_brain.png');
scene.load.image('menuBackground', 'assets/placeholder/menuBackground.png');
......
......@@ -459,11 +459,18 @@ var gameScene = new Phaser.Class(
WordSpace.setPlayerTyping.initiate(this);
WordSpace.nameQueue.initiate();
//WordSpace.attackGauge.add(11);
WordSpace.generateWord.Item(ScenesData.gameScene, Enums.item.invincible);
WordSpace.generateWord.Item(ScenesData.gameScene, Enums.item.invincible);
WordSpace.generateWord.Item(ScenesData.gameScene, Enums.item.invincible);
this.warningImage = this.add.sprite(game.config.width / 2, game.config.height / 2, 'weightWarning').setDisplaySize(game.config.width, game.config.height).setDepth(0.1).setAlpha(0)
this.warningTween = this.tweens.add({
targets: this.warningImage,
alpha: 1,
duration: 500,
ease: 'Linear',
yoyo: true,
repeat: -1
});
this.warningTween.timeScale = 0;
WordSpace.changePhase(WordSpace.Phase.START);
},
......@@ -487,6 +494,26 @@ var gameScene = new Phaser.Class(
WordSpace.weightTextObjForTest.setText('뇌의 무게: (현재) '+WordSpace.totalWeight+' / '+ WordSpace.brainCapacity+' (전체)');
WordSpace.setPlayerTyping.add('');
if(!WordSpace.isGameOver)
{
if(WordSpace.totalWeight < 180)
{
this.warningTween.timeScale = 0;
}
else if(WordSpace.totalWeight < 190)
{
this.warningTween.timeScale = 0.3;
}
else if(WordSpace.totalWeight < 200)
{
this.warningTween.timeScale = 0.6;
}
else if(WordSpace.isTimerOn)
{
this.warningTween.timeScale = 0.6 + WordSpace.gameOverCycle.currentCycle.getElapsed() / WordSpace.delay.GameOver * 3;
}
}
}
}
});
......
......@@ -9,6 +9,7 @@ WordSpace.totalWeight = 0; //현재 단어 무게 총합
WordSpace.totalWordNum = 0;
WordSpace.brainCapacity = 200; //수용 가능한 단어 무게 최대치
WordSpace.gameTimer = null; //현재 게임 플레이 시간 타이머
WordSpace.isGameOver = false;
WordSpace.isTimerOn = false;
WordSpace.isInvincible = false;
WordSpace.pyeongminAnims = [];
......@@ -516,6 +517,7 @@ WordSpace.resetGame = function()
WordSpace.totalWordNum = 0;
WordSpace.brainCapacity = 200; //수용 가능한 단어 무게 최대치
WordSpace.gameTimer = null; //현재 게임 플레이 시간 타이머
WordSpace.isGameOver = false;
WordSpace.isTimerOn = false;
WordSpace.isInvincible = false;
WordSpace.pyeongminAnims = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment