Commit 01a8a5a3 authored by 18류지석's avatar 18류지석

Merge remote-tracking branch 'origin/image'

# Conflicts:
#	js/WordObject.js
parents 0d59c5be 66b2da34
......@@ -4,7 +4,7 @@ BackGround.brainGroup = null;
BackGround.loadImage = function(scene)
{
scene.load.image('brainGround', 'assets/placeholder/playback.png');
scene.load.image('brainGround', 'assets/image/background/background_brain.png');
scene.load.image('menuBackground', 'assets/placeholder/menuBackground.png')
}
......
class WordObject
{
constructor(text)
constructor(text, isNameWord = false)
{
this.generationCode = WordSpace.nextWordCode++;
this.wordText = text;
......@@ -9,21 +9,35 @@ class WordObject
this.wordWeight = WordReader.getWordWeight(this.wordGrade);
//console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
this.wordSpeed = 0.5;
this.isNameWord = isNameWord;
}
instantiate(scene,lenRate)
instantiate(scene, lenRate)
{
let p = [{x : 3, y : 0.7}, {x : 20, y : 1.8}];
let scale = ((p[1].y - p[0].y) / (p[1].x - p[0].x)) * (this.wordWeight - p[0].x) + p[0].y;
let fontscale = 25;
var random = WordSpace.getSpawnPoint(lenRate);
if (!this.isNameWord)
{
this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6))
.setMass(this.wordWeight * 10)
.setScale(scale)
.setFrictionX(0)
.setFrictionY(0)
.setBounce(0.5);
}
else
{
this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'nameBgr' + Math.min(Math.max(2, this.wordText.length), 6))
.setMass(this.wordWeight * 10)
.setScale(scale)
.setFrictionX(0)
.setFrictionY(0)
.setBounce(0.5);
}
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);
......@@ -37,7 +51,9 @@ class WordObject
fontSize: (scale * fontscale) +'pt',
fontFamily: '"궁서", 궁서체, serif',
fontStyle: (this.wordWeight > 5 ? 'bold' : '')
}).setColor('#000000').setOrigin(0.5,0.5);
});
if (!this.isNameWord) this.wordObj.setColor('#000000').setOrigin(0.5,0.5);
else this.wordObj.setColor('#ffffff').setOrigin(0.45,0.5);
WordSpace.totalWeight += this.wordWeight;
WordSpace.totalWordNum += 1;
WordSpace.setGameOverTimer();
......@@ -150,7 +166,7 @@ class NameWord extends WordObject
{
constructor(player, _isStrong = false)
{
super(player.nickname);
super(player.nickname, true);
this.ownerId = player.id;
this.wordWeight = 2;
this.isStrong = _isStrong;
......
......@@ -219,8 +219,6 @@ WordSpace.genWordByProb = function(scene)
WordSpace.loadImage = function(scene)
{
if (!this.isImageLoaded)
{
for (let i = 0; i < 4; i++)
{
for (let j = 2; j < 7; j++)
......@@ -232,7 +230,11 @@ WordSpace.loadImage = function(scene)
{
scene.load.image('attackAlert' + i, 'assets/placeholder/attackalert' + (i+1) + '.png');
}
for (let i = 2; i < 7; i++)
{
scene.load.image('nameBgr' + i, 'assets/placeholder/name' + i + '.png');
}
WordSpace.gameSceneForTest = scene; // for test
WordSpace.weightTextObjForTest = scene.add.text(100, 75, '뇌의 무게: (현재) 0 / 100 (전체)').setDepth(10).setColor('#000000');
}
......
......@@ -8,7 +8,7 @@ var config = {
debug: true
}
},
backgroundColor: Phaser.Display.Color.GetColor(0,0,0),
backgroundColor: Phaser.Display.Color.HexStringToColor('#F0CB85').color,//GetColor(245,208,138),
scene: [ menuScene, gameScene ]
};
......
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