Commit de3f433d authored by 18신대성's avatar 18신대성 Committed by 16이지혜

단어 생성위치를 8군데로 정해서 나오게 함

parent 302fe1fa
...@@ -25,16 +25,16 @@ class WordObject ...@@ -25,16 +25,16 @@ class WordObject
instantiate(scene) instantiate(scene)
{ {
var randomX = Phaser.Math.Between(100, 700); var random = WordSpace.spawnPoint[Math.floor(Math.random() * (WordSpace.spawnPoint.length))];
this.physicsObj = scene.physics.add.sprite(randomX, 100, 'wordBackground').setScale(0.3); this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBackground').setScale(0.3);
this.physicsObj.body.bounce.set(0.5); this.physicsObj.body.bounce.set(0.5);
this.wordObj = scene.add.text(randomX, 100, this.wordText, {fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000'); this.wordObj = scene.add.text(random.x, random.y, this.wordText, {fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000').setOrigin(0.5,0.5);
this.wordObj.setOrigin(0.5,0.5);
} }
destroy() destroy()
{ {
console.log(this.generationCode + ': ' + this.wordText + ' destroyed'); console.log(this.generationCode + ': ' + this.wordText + ' destroyed');
WordSpace.totalWeight -= this.wordWeight;
this.wordObj.destroy(); this.wordObj.destroy();
const groupIdx = WordSpace.wordGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this); const groupIdx = WordSpace.wordGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this);
if (groupIdx > -1) WordSpace.wordGroup.splice(groupIdx, 1); if (groupIdx > -1) WordSpace.wordGroup.splice(groupIdx, 1);
......
...@@ -4,7 +4,7 @@ WordSpace.isImageLoaded = false; ...@@ -4,7 +4,7 @@ WordSpace.isImageLoaded = false;
WordSpace.nextWordCode = 0; WordSpace.nextWordCode = 0;
WordSpace.totalWeight = 0; //현재 단어 무게 총합 WordSpace.totalWeight = 0; //현재 단어 무게 총합
WordSpace.brainCapacity = 20; //수용 가능한 단어 무게 최대치 WordSpace.brainCapacity = 200; //수용 가능한 단어 무게 최대치
WordSpace.defeatTime = 3000; WordSpace.defeatTime = 3000;
WordSpace.gameOverTimer = null; //게임 오버 판정 타이머 WordSpace.gameOverTimer = null; //게임 오버 판정 타이머
WordSpace.isTimerOn = false; WordSpace.isTimerOn = false;
...@@ -14,6 +14,17 @@ WordSpace.wordForcedGroup = []; ...@@ -14,6 +14,17 @@ WordSpace.wordForcedGroup = [];
WordSpace.wordPhysicsGroup = null; WordSpace.wordPhysicsGroup = null;
WordSpace.gravityPoint = {x: 400, y: 300}; WordSpace.gravityPoint = {x: 400, y: 300};
WordSpace.spawnPoint =
[
{x: 100, y: 100},
{x: 100, y: 300},
{x: 100, y: 500},
{x: 400, y: 100},
{x: 400, y: 500},
{x: 700, y: 100},
{x: 700, y: 300},
{x: 700, y: 500},
]
WordSpace.attackGauge = WordSpace.attackGauge =
{ {
......
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