Commit 89b6ee4c authored by 18손재민's avatar 18손재민

이제 호패가 이름 밑으로 갈 때 콜라이더가 사라짐

parent 52fb28f4
...@@ -76,6 +76,20 @@ var gameScene = new Phaser.Class( ...@@ -76,6 +76,20 @@ var gameScene = new Phaser.Class(
} }
}); });
console.log(RoomData.myself); console.log(RoomData.myself);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
}, },
update: function() update: function()
......
...@@ -10,7 +10,6 @@ class WordObject ...@@ -10,7 +10,6 @@ class WordObject
//console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n'); //console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
this.wordSpeed = 0.5; this.wordSpeed = 0.5;
this.isNameWord = isNameWord; this.isNameWord = isNameWord;
this.collider = null;
} }
instantiate(scene, lenRate) instantiate(scene, lenRate)
...@@ -38,8 +37,8 @@ class WordObject ...@@ -38,8 +37,8 @@ class WordObject
.setFrictionY(0) .setFrictionY(0)
.setBounce(0.5); .setBounce(0.5);
} }
this.physicsObj.wordCollider = null;
let dist = Phaser.Math.Distance.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y); let dist = Phaser.Math.Distance.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y);
let angle = Phaser.Math.Angle.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y); let angle = Phaser.Math.Angle.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y);
...@@ -71,10 +70,11 @@ class WordObject ...@@ -71,10 +70,11 @@ class WordObject
if (groupIdx > -1) WordSpace.wordGroup.splice(groupIdx, 1); if (groupIdx > -1) WordSpace.wordGroup.splice(groupIdx, 1);
const forceIdx = WordSpace.wordForcedGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this); const forceIdx = WordSpace.wordForcedGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this);
if (forceIdx > -1) WordSpace.wordForcedGroup.splice(forceIdx, 1); if (forceIdx > -1) WordSpace.wordForcedGroup.splice(forceIdx, 1);
WordSpace.wordPhysicsGroup.remove(this.physicsObj);
if(!this.isNameWord) if(!this.isNameWord)
{ {
this.wordObj.destroy(); this.wordObj.destroy();
WordSpace.wordPhysicsGroup.remove(this.physicsObj, true, true); this.physicsObj.destroy();
} }
} }
...@@ -192,19 +192,23 @@ class NameWord extends WordObject ...@@ -192,19 +192,23 @@ class NameWord extends WordObject
} }
destroy() destroy()
{ {
super.destroy();
WordSpace.gameSceneForTest.physics.world.removeCollider(this.physicsObj.wordCollider);
WordSpace.wordGroup.forEach(function(element)
{
WordSpace.gameSceneForTest.physics.world.removeCollider(element.physicsObj.wordCollider);
element.physicsObj.wordCollider = WordSpace.gameSceneForTest.physics.add.collider(element.physicsObj, WordSpace.wordPhysicsGroup, function(object1)
{
object1.topObj.attract();
});
});
WordSpace.attackGauge.add(this.wordTyping * 0.1); WordSpace.attackGauge.add(this.wordTyping * 0.1);
WordSpace.nameGroup.push(this); WordSpace.nameGroup.push(this);
this.isActive = false; this.isActive = false;
this.physicsObj.setVelocity(0, 0); this.physicsObj.setVelocity(0, 0).setDepth(2);
//this.physicsObj.setPosition(500 + WordSpace.nameGroup.length * 25, 650).setDepth(2);
//this.physicsObj.angle = 90;
this.physicsObj.setDepth(2);
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y).setDepth(2); this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y).setDepth(2);
this.wordObj.angle = 90;
WordSpace.gameSceneForTest.physics.world.removeCollider(this.physicsObj);
this.follower = { t: 0, vec: new Phaser.Math.Vector2() }; this.follower = { t: 0, vec: new Phaser.Math.Vector2() };
this.path = new Phaser.Curves.Spline([ this.path = new Phaser.Curves.Spline([
this.physicsObj.x, this.physicsObj.y, this.physicsObj.x, this.physicsObj.y,
(this.physicsObj.x + 500 + WordSpace.nameGroup.length * 25) / 2, this.physicsObj.y - 50, (this.physicsObj.x + 500 + WordSpace.nameGroup.length * 25) / 2, this.physicsObj.y - 50,
...@@ -213,15 +217,14 @@ class NameWord extends WordObject ...@@ -213,15 +217,14 @@ class NameWord extends WordObject
WordSpace.gameSceneForTest.tweens.add({ WordSpace.gameSceneForTest.tweens.add({
targets: this.follower, targets: this.follower,
t: 1, t: 1,
ease: 'Sine.easeInOut', ease: 'Sine',
duration: 4000, duration: 4000,
repeat: 0 repeat: 0
}); });
var graphics = WordSpace.gameSceneForTest.add.graphics(); //이동경로 디버그
/*var graphics = WordSpace.gameSceneForTest.add.graphics();
graphics.lineStyle(2, 0xffffff, 1); graphics.lineStyle(2, 0xffffff, 1);
this.path.draw(graphics); this.path.draw(graphics);*/
super.destroy();
} }
} }
...@@ -267,7 +267,7 @@ WordSpace.pushWord = function(scene, word, lenRate) ...@@ -267,7 +267,7 @@ WordSpace.pushWord = function(scene, word, lenRate)
WordSpace.wordGroup.push(word); WordSpace.wordGroup.push(word);
WordSpace.wordForcedGroup.push(word); WordSpace.wordForcedGroup.push(word);
word.physicsObj.topObj = word; word.physicsObj.topObj = word;
scene.physics.add.collider(word.physicsObj, WordSpace.wordPhysicsGroup, function(object1) word.physicsObj.wordCollider = scene.physics.add.collider(word.physicsObj, WordSpace.wordPhysicsGroup, function(object1)
{ {
//object1.topObj.wordSpeed = 0.1; //object1.topObj.wordSpeed = 0.1;
object1.topObj.attract(); object1.topObj.attract();
......
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