Commit 6d3b8c47 authored by 18신대성's avatar 18신대성

중력을 없애는 대신 wordSpeed를 바꿈

parent 30b700e5
...@@ -25,7 +25,7 @@ class WordObject ...@@ -25,7 +25,7 @@ class WordObject
_wordGrade == 1 ? 7 : 10; _wordGrade == 1 ? 7 : 10;
return temp; return temp;
})(this.wordGrade); })(this.wordGrade);
this.isForced = true; this.wordSpeed = 1;
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n'); //alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
} }
...@@ -49,14 +49,11 @@ class WordObject ...@@ -49,14 +49,11 @@ class WordObject
WordSpace.wordPhysicsGroup.remove(this.physicsObj, true, true); WordSpace.wordPhysicsGroup.remove(this.physicsObj, true, true);
} }
attract(wordSpeed) attract()
{
if (this.isForced)
{ {
var dist = Phaser.Math.Distance.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y); var dist = Phaser.Math.Distance.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y);
var angle = Phaser.Math.Angle.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y); var angle = Phaser.Math.Angle.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y);
this.physicsObj.setVelocity(dist * Math.cos(angle) * wordSpeed, dist * Math.sin(angle) * wordSpeed); this.physicsObj.setVelocity(dist * Math.cos(angle) * this.wordSpeed, dist * Math.sin(angle) * this.wordSpeed);
}
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y); this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y);
} }
......
...@@ -89,7 +89,7 @@ WordSpace.generateWord = function(scene) ...@@ -89,7 +89,7 @@ WordSpace.generateWord = function(scene)
word.physicsObj.topObj = word; word.physicsObj.topObj = word;
scene.physics.add.collider(word.physicsObj, WordSpace.wordPhysicsGroup, function(object1) scene.physics.add.collider(word.physicsObj, WordSpace.wordPhysicsGroup, function(object1)
{ {
if (object1.topObj.isForced) object1.topObj.isForced = false; if (object1.topObj.wordSpeed > 0.5) object1.topObj.wordSpeed = 0.05;
}); });
scene.physics.add.collider(word.physicsObj, BackGround.brainGroup); scene.physics.add.collider(word.physicsObj, BackGround.brainGroup);
WordSpace.wordPhysicsGroup.add(word.physicsObj); WordSpace.wordPhysicsGroup.add(word.physicsObj);
......
...@@ -39,7 +39,7 @@ function update() ...@@ -39,7 +39,7 @@ function update()
{ {
WordSpace.wordForcedGroup.forEach(function(element) WordSpace.wordForcedGroup.forEach(function(element)
{ {
element.attract(0.3); element.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