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

stackalert외 다른 placeholder들 게임에 적용함

parent 41b11841
...@@ -8,21 +8,11 @@ BackGround.loadImage = function(scene) ...@@ -8,21 +8,11 @@ BackGround.loadImage = function(scene)
{ {
if (!this.isImageLoaded) if (!this.isImageLoaded)
{ {
scene.load.image('brainGround0', 'assets/platform.png'); // horizontal scene.load.image('brainGround0', 'assets/placeholder/playback.png');
scene.load.image('brainGround1', 'assets/platform2.png'); // vertical
} }
} }
BackGround.drawBrain = function(scene) BackGround.drawBrain = function(scene)
{ {
brains = scene.physics.add.staticGroup(); brains = scene.add.sprite(640, 360, 'brainGround0').setDisplaySize(1282, 722).setDepth(1);
brains.create(400, 500, 'brainGround0').setScale(1.5).setDepth(1).refreshBody();
brains.create(400, 100, 'brainGround0').setScale(1.5).setDepth(1).refreshBody();
brains.create(100, 300, 'brainGround1').setScale(0.5).setDepth(1).refreshBody();
brains.create(700, 300, 'brainGround1').setScale(0.5).setDepth(1).refreshBody();
brains.immovable = true;
this.brainGroup = brains;
} }
\ No newline at end of file
...@@ -273,8 +273,8 @@ Input.inputField = ...@@ -273,8 +273,8 @@ Input.inputField =
{ {
generate: function(scene) generate: function(scene)
{ {
this.background = scene.add.sprite(400, 500, 'inputFieldBackground').setScale(0.2).setDepth(10); this.background = scene.add.sprite(640, 550, 'inputfield').setDepth(10);
this.text = scene.add.text(400, 500, "안녕하세요", {font: '15pt 궁서'}).setOrigin(0.5, 0.5).setColor('#000000').setDepth(10); this.text = scene.add.text(640, 550, "안녕하세요", {font: '25pt 궁서'}).setOrigin(0.5, 0.5).setColor('#000000').setDepth(10);
scene.input.keyboard.on('keyup', function() {Input.pressCount--; Input.justPressed = ''}) scene.input.keyboard.on('keyup', function() {Input.pressCount--; Input.justPressed = ''})
scene.input.keyboard.on('keydown-SHIFT', function() {Input.isShifted = true}); scene.input.keyboard.on('keydown-SHIFT', function() {Input.isShifted = true});
...@@ -327,7 +327,7 @@ Input.inputField = ...@@ -327,7 +327,7 @@ Input.inputField =
}, },
loadImage: function(scene) loadImage: function(scene)
{ {
scene.load.image('inputFieldBackground', 'assets/inputFieldBackground.png'); scene.load.image('inputfield', 'assets/placeholder/inputfield.png');
} }
} }
......
...@@ -22,10 +22,10 @@ class WordObject ...@@ -22,10 +22,10 @@ class WordObject
instantiate(scene) instantiate(scene)
{ {
var random = WordSpace.spawnPoint[Math.floor(Math.random() * (WordSpace.spawnPoint.length))]; var random = WordSpace.getSpawnPoint();
this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBackground').setScale(0.3); this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6));
this.physicsObj.body.bounce.set(0.5); this.physicsObj.body.bounce.set(0.5);
this.wordObj = scene.add.text(random.x, random.y, this.wordText, {fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000').setOrigin(0.5,0.5); this.wordObj = scene.add.text(random.x, random.y, this.wordText, {fontSize: '18pt', fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000').setOrigin(0.5,0.5);
WordSpace.totalWeight += this.wordWeight; WordSpace.totalWeight += this.wordWeight;
WordSpace.setGameOverTimer(); WordSpace.setGameOverTimer();
console.log("Total weight : " + WordSpace.totalWeight); console.log("Total weight : " + WordSpace.totalWeight);
......
...@@ -15,18 +15,16 @@ WordSpace.wordGroup = []; ...@@ -15,18 +15,16 @@ WordSpace.wordGroup = [];
WordSpace.wordForcedGroup = []; WordSpace.wordForcedGroup = [];
WordSpace.wordPhysicsGroup = null; WordSpace.wordPhysicsGroup = null;
WordSpace.gravityPoint = {x: 400, y: 300}; WordSpace.gravityPoint = {x: 640, y: 300};
WordSpace.spawnPoint = WordSpace.getSpawnPoint = function()
[ {
{x: 100, y: 100}, let xLen = 600;
{x: 100, y: 300}, let yLen = 300;
{x: 100, y: 500}, const angle = Math.random() * Math.PI * 2;
{x: 400, y: 100}, let _x = xLen * Math.cos(angle) + this.gravityPoint.x;
{x: 400, y: 500}, let _y = yLen * Math.sin(angle) + this.gravityPoint.y;
{x: 700, y: 100}, return {x:_x, y:_y};
{x: 700, y: 300}, }
{x: 700, y: 500},
]
WordSpace.attackGauge = WordSpace.attackGauge =
{ {
...@@ -94,7 +92,13 @@ WordSpace.loadImage = function(scene) ...@@ -94,7 +92,13 @@ WordSpace.loadImage = function(scene)
{ {
if (!this.isImageLoaded) if (!this.isImageLoaded)
{ {
scene.load.image('wordBackground', 'assets/wordBackground.png'); for (let i = 0; i < 4; i++)
{
for (let j = 2; j < 7; j++)
{
scene.load.image(('wordBgr' + i + '_' + j), ('assets/placeholder/'+i + '_' + j + '.png'));
}
}
} }
WordSpace.gameSceneForTest = scene; // for test WordSpace.gameSceneForTest = scene; // for test
} }
...@@ -111,7 +115,6 @@ WordSpace.generateWord = function(scene, wordText) ...@@ -111,7 +115,6 @@ WordSpace.generateWord = function(scene, wordText)
object1.topObj.wordSpeed = 0.1; object1.topObj.wordSpeed = 0.1;
object1.topObj.attract(); object1.topObj.attract();
}); });
scene.physics.add.collider(word.physicsObj, BackGround.brainGroup);
WordSpace.wordPhysicsGroup.add(word.physicsObj); WordSpace.wordPhysicsGroup.add(word.physicsObj);
} }
......
var config = { var config = {
type: Phaser.AUTO, type: Phaser.AUTO,
width: 800, width: 1280,
height: 600, height: 720,
physics: { physics: {
default: 'arcade', default: 'arcade',
arcade: { arcade: {
......
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