Commit 0b81dc2a authored by 18손재민's avatar 18손재민 Committed by 18신대성

공격 단어 반격 시간 마스크로 표시함

parent 008e21b6
...@@ -91,7 +91,7 @@ GameServer.enterRoom = function(roomIdx, playerData) ...@@ -91,7 +91,7 @@ GameServer.enterRoom = function(roomIdx, playerData)
{ {
if (room.currentPhase === this.Phase.READY) // start count if (room.currentPhase === this.Phase.READY) // start count
{ {
room.endTime = Date.now() + 15000; // 테스트로 15초로 남겨둠 room.endTime = Date.now() + 1000; // 테스트로 15초로 남겨둠
this.announceToRoom(room.roomNum, 'setCount', {isEnable: true, endTime: room.endTime}); this.announceToRoom(room.roomNum, 'setCount', {isEnable: true, endTime: room.endTime});
room.currentPhase = this.Phase.COUNT; room.currentPhase = this.Phase.COUNT;
} }
......
...@@ -158,22 +158,15 @@ class AttackWord extends WordObject ...@@ -158,22 +158,15 @@ class AttackWord extends WordObject
this.maskBackground = scene.physics.add.sprite(this.physicsObj.x, this.physicsObj.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6)) 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.scale); .setTint(Phaser.Display.Color.GetColor(120, 120, 120)).setScale(this.scale);
this.maskBackground.alpha = 0.5; this.maskBackground.alpha = 0.5;
console.log('scale ' + this.scale);
console.log('this.physicsObj.width ' + this.physicsObj.width);
console.log('this.physicsObj.height ' + this.physicsObj.height);
console.log('this.physicsObj.body.width ' + this.physicsObj.body.width);
console.log('this.physicsObj.body.height ' + this.physicsObj.body.height);
this.shape = scene.make.graphics(); this.shape = scene.make.graphics();
var rect = new Phaser.Geom.Rectangle(0, 0, this.physicsObj.width, this.physicsObj.height); var rect = new Phaser.Geom.Rectangle(0, 0, this.maskBackground.width * this.scale, this.maskBackground.height * this.scale);
console.log(rect);
console.log(this.shape);
this.shape.fillStyle(0xffffff).fillRectShape(rect); this.shape.fillStyle(0xffffff).fillRectShape(rect);
this.mask = this.shape.createGeometryMask(); this.mask = this.shape.createGeometryMask();
this.maskBackground.setMask(this.mask); this.maskBackground.setMask(this.mask);
this.maskStart = this.physicsObj.x; this.maskStart = this.physicsObj.x;
this.maskEnd = this.physicsObj.x - this.physicsObj.width; this.maskEnd = this.physicsObj.x - this.physicsObj.width * this.scale;
} }
attract() attract()
...@@ -183,8 +176,8 @@ class AttackWord extends WordObject ...@@ -183,8 +176,8 @@ class AttackWord extends WordObject
{ {
this.maskBackground.setPosition(this.physicsObj.x, this.physicsObj.y); this.maskBackground.setPosition(this.physicsObj.x, this.physicsObj.y);
this.shape.x = this.physicsObj.x + (this.maskEnd - this.maskStart) * this.shape.x = this.physicsObj.x + (this.maskEnd - this.maskStart) *
((WordSpace.gameTimer.now - this.createdTime) / (this.counterTime - this.createdTime)) - this.physicsObj.width / 2; ((WordSpace.gameTimer.now - this.createdTime) / (this.counterTime - this.createdTime)) - this.physicsObj.width * this.scale / 2;
this.shape.y = this.physicsObj.y - this.physicsObj.height / 2; this.shape.y = this.physicsObj.y - this.physicsObj.height * this.scale / 2;
} }
else if(this.maskBackground != null) this.maskBackground.destroy(); else if(this.maskBackground != null) this.maskBackground.destroy();
} }
...@@ -224,7 +217,8 @@ class NameWord extends WordObject ...@@ -224,7 +217,8 @@ class NameWord extends WordObject
attract() attract()
{ {
if(this.isActive) super.attract(); if(this.isActive) super.attract();
else{ else
{
this.path.getPoint(this.follower.t, this.follower.vec); this.path.getPoint(this.follower.t, this.follower.vec);
this.physicsObj.setPosition(this.follower.vec.x, this.follower.vec.y); this.physicsObj.setPosition(this.follower.vec.x, this.follower.vec.y);
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y); this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y);
......
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