Commit 93ded99d authored by 18손재민's avatar 18손재민 Committed by 18류지석

enum 생성함, 공격 단어 반격 시간 마스크 wip

parent 61daf001
......@@ -13,6 +13,7 @@
<script src="js/CSVParsing.js"></script>
<script src="js/SelectWord.js"></script>
<script src="js/BGMsound.js"></script>
<script src="js/Enums.js"></script>
</head>
<body>
<script src="js/Client.js"></script>
......
var Enums = Enums || {};
\ No newline at end of file
var Enums = Enums || {};
Enums.characterAnim = { write: 0, attackWrite: 1, throw: 2, hit: 3 }
\ No newline at end of file
......@@ -49,7 +49,7 @@ class WordObject
{
fontSize: (this.scale * this.fontScale) +'pt',
fontFamily: '"궁서", 궁서체, serif',
fontStyle: (this.wordWeight > 5 ? 'bold' : '')
//fontStyle: (this.wordWeight > 5 ? 'bold' : '')
});
if (!this.isNameWord) this.wordObj.setColor('#000000').setOrigin(0.5,0.5);
else this.wordObj.setColor('#ffffff').setOrigin(0.45,0.5);
......@@ -79,7 +79,7 @@ class WordObject
this.wordObj.destroy();
this.physicsObj.destroy();
}
BackGround.myCharacter.play(WordSpace.pyeongminAnims[0]);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[Enums.characterAnim.write]);
}
attract()
......@@ -150,6 +150,28 @@ class AttackWord extends WordObject
console.log('Attack text : ' + text + ', Attacker : ' + this.attacker.nickname + ', Weight : ' + this.wordWeight);
console.log('Counter time : ' + this.counterTime);
}
instantiate(scene, lenRate)
{
super.instantiate(scene, lenRate);
this.maskBackground = scene.physics.add.sprite(this.physicsObj.x, this.physicsObj.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6))
.setTint(Phaser.Display.Color.GetColor(120, 120, 120)).setScale(this.physicsObj.scale);
this.shape = scene.make.graphics();
var rect = new Phaser.Geom.Rectangle(0, 0, this.maskBackground.width, this.maskBackground.height);
this.shape.fillStyle(0xffffff);
this.shape.fillRectShape(rect);
this.mask = this.shape.createGeometryMask();
this.maskBackground.setMask(this.mask);
}
attract()
{
super.attract();
this.maskBackground.setPosition(this.physicsObj.x, this.physicsObj.y);
this.mask.x = this.physicsObj.x;
this.mask.y = this.physicsObj.y;
}
destroy()
{
switch(this.wordGrade)
......
......@@ -256,20 +256,27 @@ WordSpace.loadAnimation = function(scene)
repeat: 0,
hideOnComplete: false
});
WordSpace.pyeongminAnims.push(scene.anims.create({
key: 'write',
WordSpace.pyeongminAnims[Enums.characterAnim.write] = scene.anims.create({
key: 'pyeongminWriteAnim',
frames: scene.anims.generateFrameNumbers('pyeongminWrite'),
frameRate: 10,
repeat: 0,
hideOnComplete: false
}));
WordSpace.pyeongminAnims.push(scene.anims.create({
key: 'throw',
});
WordSpace.pyeongminAnims[Enums.characterAnim.attackWrite] = scene.anims.create({
key: 'pyeongminattackWriteAnim',
frames: scene.anims.generateFrameNumbers('pyeongminWrite'),
frameRate: 10,
repeat: -1,
hideOnComplete: false
});
WordSpace.pyeongminAnims[Enums.characterAnim.throw] = scene.anims.create({
key: 'pyeongminThrowAnim',
frames: scene.anims.generateFrameNumbers('pyeongminThrow'),
frameRate: 10,
repeat: 0,
hideOnComplete: false
}));
});
}
WordSpace.generateWord =
......@@ -373,6 +380,8 @@ WordSpace.findWord = function(wordText)
Input.attackMode = true;
WordSpace.attackGauge.pauseCycle(true);
WordSpace.setPlayerTyping.add(wordText);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[Enums.characterAnim.attackWrite]);
BackGround.myCharacter.anims.msPerFrame /= (4 - WordSpace.attackGauge.getAttackOption().wordGrade);
}
else // 오타 체크
{
......@@ -450,7 +459,7 @@ WordSpace.attack = function(wordText, grade)
WordSpace.attackGauge.resetValue();
WordSpace.setPlayerTyping.add(wordText);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[1]);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[Enums.characterAnim.throw]);
}
else WordSpace.attackGauge.cutValue(0.3);
Input.maxInput = 6;
......
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