Add: grilled meat basic sources

This commit is contained in:
2018-10-31 11:12:42 +09:00
parent 2e1ae58e7f
commit 5464642d9b
28 changed files with 965 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+177
View File
@@ -0,0 +1,177 @@
DudeCard.prototype = Object.create(Phaser.Sprite.prototype);
DudeCard.prototype.constructor = DudeCard;
function DudeCard(game, col, row, cardCharacters, clickedHandler) {
this.cardIndex = row * DudeCard.MAX_CARD_COLUMN_NO + col;
this.columnNo = col;
this.rowNo = row;
this.cardCharacters = cardCharacters;
this.characterNo = 0;
this.clickedHandler = clickedHandler;
this.isActivated = true;
this.backupScale = 1;
Phaser.Sprite.call(this, game, DudeCard.CARD_INITIAL_POSITION_X, DudeCard.CARD_INITIAL_POSITION_Y, 'card_front');
this.anchor.set(0.5);
this.scale.set(1);
this.smoothed = false;
this.character = game.add.sprite(0, 0, 'commoner');
this.character.anchor.set(0.5);
this.character.scale.set(7);
this.character.smoothed = false;
this.addChild(this.character);
this.backPaper = game.add.sprite(0, 0, 'card_back');
this.backPaper.anchor.set(0.5);
this.backPaper.scale.set(1);
this.backPaper.smoothed = false;
this.backPaper.alpha = 0;
this.addChild(this.backPaper);
this.inputEnabled = true;
this.events.onInputDown.add(this.onDown, this);
this.showAndHideEvent = null;
game.add.existing(this);
}
DudeCard.prototype.onDown = function(sprite) {
if(this.isActivated == false)
return;
this.clickedHandler(this.columnNo, this.rowNo);
/*
if(this.backPaper.alpha == 0) {
this.flipToFront();
} else {
this.flipToBack();
}
*/
}
DudeCard.prototype.setScale = function(size) {
this.scale.set(size);
this.backupScale = size;
}
DudeCard.prototype.setCharacter = function(characterNo) {
this.characterNo = characterNo;
this.character.loadTexture(this.cardCharacters[characterNo]);
}
DudeCard.prototype.getCharacter = function() {
return this.characterNo;
}
DudeCard.prototype.getCardIndex = function() {
return this.cardIndex;
}
DudeCard.prototype.getColumnNo = function() {
return this.columnNo;
}
DudeCard.prototype.getRowNo = function() {
return this.rowNo;
}
DudeCard.prototype.isFront = function() {
if(this.backPaper.alpha == 0)
return true;
return false;
}
DudeCard.prototype.flipToFront = function() {
this.backPaper.alpha = 0;
}
DudeCard.prototype.flipToBack = function() {
this.backPaper.alpha = 1;
}
DudeCard.prototype.move = function(openCardColumnNo, openCardRowNo) {
this.x = game.world.centerX - (((openCardColumnNo - 1) / 2) - this.columnNo) * 180;
this.y = game.world.centerY - (((openCardRowNo - 1) / 2) - this.rowNo) * 160;
}
DudeCard.prototype.setActive = function(value) {
this.isActivated = value;
}
DudeCard.prototype.show = function() {
this.alpha = 1;
}
DudeCard.prototype.startShowAndHideAnimation = function() {
this.flipToFront();
this.showAndHideEvent = game.time.events.add(
DudeCard.SHOW_AND_HIDE_TIME_SECOND * Phaser.Timer.SECOND,
this.finishShowAndHideAnimation,
this
);
}
DudeCard.prototype.finishShowAndHideAnimation = function() {
this.flipToBack();
this.removeShowAndHideEvent();
}
DudeCard.prototype.hide = function() {
this.alpha = 0;
this.x = DudeCard.CARD_INITIAL_POSITION_X;
this.y = DudeCard.CARD_INITIAL_POSITION_Y;
this.removeShowAndHideEvent();
}
DudeCard.prototype.removeShowAndHideEvent = function() {
if(this.showAndHideEvent != null) {
game.time.events.remove(this.showAndHideEvent);
}
}
DudeCard.prototype.startWaitAndHideAnimation = function() {
this.showAndHideEvent = game.time.events.add(
DudeCard.WAIT_AND_HIDE_TIME_SECOND * Phaser.Timer.SECOND,
this.finishWaitAndHideAnimation,
this
);
}
DudeCard.prototype.finishWaitAndHideAnimation = function() {
this.hide();
}
DudeCard.prototype.startWaitAndFlipToBackAnimation = function() {
this.showAndHideEvent = game.time.events.add(
DudeCard.WAIT_AND_FLIP_TO_BACK_TIME_SECOND * Phaser.Timer.SECOND,
this.finishWaitAndFlipToBackAnimation,
this
);
}
DudeCard.prototype.finishWaitAndFlipToBackAnimation = function() {
this.flipToBack();
}
DudeCard.MAX_CARD_COLUMN_NO = 5;
DudeCard.MAX_CARD_ROW_NO = 4;
DudeCard.CARD_INITIAL_POSITION_X = -100;
DudeCard.CARD_INITIAL_POSITION_Y = -100;
DudeCard.SHOW_AND_HIDE_TIME_SECOND = 0.5;
DudeCard.WAIT_AND_HIDE_TIME_SECOND = 0.5;
DudeCard.WAIT_AND_FLIP_TO_BACK_TIME_SECOND = 0.5;
DudeCard.INIT_LEFT_TIME_MIN = 2;
+145
View File
@@ -0,0 +1,145 @@
var Game = {
create: function() {
this.game.stage.backgroundColor = "#000000"; // '#4d4d4d';
sessionStorageManager.setIsNewAppHighestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
);
// keyboard shortcut
this.keyboardShortcut = new KeyboardShortcut();
this.keyboardShortcut.addCallback(
Phaser.KeyCode.ESC, // keyCode
null, // keyDownHandler
(function() { this.back(); }).bind(this), // keyUpHandler
"card matching" // callerClassName
);
// top ui
var screenTopUI = new ScreenTopUI();
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
screenTopUI.makeFullScreenButton();
this.scoreManager = new ScoreManager();
this.scoreBoard = new ScoreBoard();
this.scoreManager.addOnChangeScoreListener(
(function(score) {
sessionStorageManager.setRecord(score);
this.scoreBoard.printScore(NumberUtil.numberWithCommas(score));
}).bind(this)
);
this.scoreManager.addOnChangeHighScoreListener(
(function(highScore) {
// console.log(highScore);
// sessionStorageManager.setAppHighestRecord(highScore);
sessionStorageManager.setIsNewBestRecrd(true);
// this.screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
}).bind(this)
);
this.setClickEnable(false);
this.stageTimer = new StageTimer(
Game.GAME_TIME_SEC,
(function() {
this.setClickEnable(false);
this.gameOver();
}).bind(this)
);
this.initVariables();
// game stage
game.stage.backgroundColor = '#4d4d4d';
graphics = game.add.graphics(0, 0);
this.plusScoreGroup = game.add.group();
var table = game.add.tileSprite(0, 340, GAME_SCREEN_SIZE.x, 660, 'wooden_table');
// bottom ui
var screenBottomUI = new ScreenBottomUI();
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName());
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
this.startGame();
// // this.countDown();
},
initVariables: function() {
},
back: function() {
sessionStorageManager.resetPlayingAppData();
location.href = '../../web/client/menu_app.html';
},
/*
countDown: function() {
const style = { font: "bold 200px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" };
this.countDownText = game.add.text(0, 0, "", style);
this.countDownText.setTextBounds(0, 0, game.world.width, game.world.height);
this.countDownText.stroke = "#333";
this.countDownText.strokeThickness = 50;
this.countDownNumber = 3;
if(isDebugMode())
this.countDownNumber = 1;
this.tweenCountDown();
},
tweenCountDown: function() {
if(this.countDownNumber === 0) {
this.startGame();
return;
}
this.countDownText.text = this.countDownNumber.toString();
this.countDownText.alpha = 1;
var countDownTween = game.add.tween(this.countDownText);
countDownTween.to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true);
countDownTween.onComplete.add(this.tweenCountDown, this);
this.countDownNumber--;
},
*/
startGame: function() {
},
startStage: function() {
},
startNextStage: function() {
},
setClickEnable: function(value) {
this.isEnableClick = value;
},
gameOver: function() {
},
goResult: function() {
location.href = '../../web/client/result.html';
},
}
Game.GAME_TIME_SEC = 60;
Game.NEXT_STAGE_DELAY_MS = 500;
+67
View File
@@ -0,0 +1,67 @@
God = function(game, x, y) {
this.isActivated = true;
Phaser.Sprite.call(this, game, x, y, 'god_angry');
this.anchor.setTo(0.5, 1);
this.scale.set(0.5);
this.inputEnabled = false;
// this.input.enableDrag(false);
// this.events.onInputDown.add(this.onDown, this);
game.add.existing(this);
}
God.prototype = Object.create(Phaser.Sprite.prototype);
God.prototype.constructor = God;
God.prototype.update = function() {
}
God.prototype.onDown = function(sprite, pointer) {
console.log("onDown : " + pointer.x + ", " + pointer.y);
this.animateAngry();
}
God.prototype.isInRect = function(x, y) {
return true;
}
God.prototype.onDragStop = function(sprite, pointer) {
console.log("onDragStop : " + pointer.x + ", " + pointer.y);
}
God.prototype.setScale = function(size) {
this.scale.set(size);
this.backupScale = size;
}
God.prototype.animateHappy = function(type) {
this.loadTexture('god_happy');
showSpeechBubble(type);
var tween = game.add.tween(god.scale);
tween.to({x:0.7, y:0.7}, 500, Phaser.Easing.Quadratic.Out, true, 0);
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true);
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
tween.onComplete.add(this.smileAgain, this);
tween.start();
}
God.prototype.animateAngry = function(type) {
this.loadTexture('god_angry');
showSpeechBubble(type);
var tween = game.add.tween(god.scale);
tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Bounce.Out, true, 0);
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true);
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
tween.onComplete.add(this.smileAgain, this);
tween.start();
}
God.prototype.smileAgain = function() {
this.scale.set(0.5);
this.loadTexture('god_smile');
}
+111
View File
@@ -0,0 +1,111 @@
var Loading = {
preload: function() {
// game.load.image('loadingbar', './image/phaser.png');
},
create: function() {
// let userID = sessionStorage.getItem("UserID");
// console.log("userID : " + userID);
// game.stage.backgroundColor = '#4d4d4d';
// // Progress report
// this.textProgress = game.add.text(game.world.centerX, 100, '로딩중 . . .', textStyleBasic);
// this.textProgress.anchor.setTo(0.5, 0.4);
// this.textProgress.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
// // Preload bar
// this.preloadBar = this.add.sprite(game.world.centerX, game.world.centerY, 'loadingbar');
// this.preloadBar.anchor.setTo(0.5);
// this.preloadBar.alpha = 0;
game.load.onFileComplete.add(this.fileComplete, this);
game.load.onLoadComplete.add(this.loadComplete, this);
this.startLoading();
},
startLoading: function() {
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
game.load.image('wooden_table', '../../../resources/image/object/grilled_meat/wooden_table.png');
game.load.image('heat_plate', '../../../resources/image/object/grilled_meat/heat_plate.png');
game.load.image('plate', '../../../resources/image/object/grilled_meat/plate.png');
game.load.image('meat1', '../../../resources/image/object/grilled_meat/meat1.png');
game.load.image('meat2', '../../../resources/image/object/grilled_meat/meat2.png');
game.load.image('meat3', '../../../resources/image/object/grilled_meat/meat3.png');
game.load.image('meatWellDone1', '../../../resources/image/object/grilled_meat/meat1_welldone.png');
game.load.image('meatWellDone2', '../../../resources/image/object/grilled_meat/meat2_welldone.png');
game.load.image('meatWellDone3', '../../../resources/image/object/grilled_meat/meat3_welldone.png');
game.load.image('meatBurn1', '../../../resources/image/object/grilled_meat/meat1_burn.png');
game.load.image('meatBurn2', '../../../resources/image/object/grilled_meat/meat2_burn.png');
game.load.image('meatBurn3', '../../../resources/image/object/grilled_meat/meat3_burn.png');
game.load.image('smoke', '../../../resources/image/object/grilled_meat/smoke.png');
game.load.image('speech_bubble_angry', '../../../resources/image/ui/speech_bubble_angry.png');
game.load.image('speech_bubble_happy', '../../../resources/image/ui/speech_bubble_happy.png');
game.load.image('god_angry', '../../../resources/image/character/god/god_hungry.png');
game.load.image('god_smile', '../../../resources/image/character/god/god_smile.png');
game.load.image('god_happy', '../../../resources/image/character/god/god_happy.png');
// game.load.image('a', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('b', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('c', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('d', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('a', './image/phaser.png');
// game.load.image('b', './image/phaser.png');
// game.load.image('c', './image/phaser.png');
// game.load.image('d', './image/phaser.png');
// game.load.image('e', './image/phaser.png');
// game.load.image('g', './image/phaser.png');
// game.load.image('e', './image/phaser.png');
// game.load.image('f', './image/phaser.png');
// game.load.image('g', './image/phaser.png');
// game.load.image('h', './image/phaser.png');
// game.load.image('phaser', './image/phaser.png');
// game.load.spritesheet('button', './image/button_basic.png', 200, 100);
// game.load.image('star', './image/star_particle.png');
// game.load.image('medal_gold', './image/medal_gold.png');
// game.load.image('medal_silver', './image/medal_silver.png');
// game.load.image('medal_bronze', './image/medal_bronze.png');
game.load.start();
},
fileComplete: function(progress, cacheKey, success, totalLoaded, totalFiles) {
// this.preloadBar.alpha = progress / 100;
// console.log('progress : ' + progress);
// text.setText("File Complete: " + progress + "% - " + totalLoaded + " out of " + totalFiles);
// var newImage = game.add.image(x, y, cacheKey);
// newImage.scale.set(0.3);
// x += newImage.width + 20;
// if (x > 700)
// {
// x = 32;
// y += 332;
// }
},
loadComplete: function(progress, cacheKey, success, totalLoaded, totalFiles) {
// this.preloadBar.alpha = 1;
if(isDebugMode()) {
this.state.start('Game');
return;
}
this.state.start('Game');
// this.startMenu();
// this.startTypingTestStage();
// this.startTypingTestResult();
}
}
+16
View File
@@ -0,0 +1,16 @@
/////////////////////////////
// Main game
const CONTENT_ID = "Grilled Meat";
let game = new Phaser.Game(
GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y,
Phaser.CANVAS, CONTENT_ID,
this, false, false
);
game.state.add('Loading', Loading);
game.state.start('Loading');
game.state.add('Game', Game);
// game.state.add('Menu', Menu);
+300
View File
@@ -0,0 +1,300 @@
var MEAT_FRONT = 0;
var MEAT_BACK = 1;
var ANGLE_NONE = 0;
var ANGLE_FRONT = 30;
var ANGLE_BACK = -30;
var COOK_TIME_WELLDONE = 200;
var COOK_TIME_BURN = 400;
var DONENESS_RARE = 0;
var DONENESS_WELLDONE = 1;
var DONENESS_BURN_BLACK = 2;
var DONENESS_NONE = 3;
Meat = function(game) {
this.cookingSide = MEAT_BACK;
this.cookingTime = [];
this.cookingGrade = [];
this.cookingTime[MEAT_BACK] = 0;
this.cookingTime[MEAT_FRONT] = 0;
this.cookingGrade[MEAT_BACK] = DONENESS_RARE;
this.cookingGrade[MEAT_FRONT] = DONENESS_RARE;
this.isActivated = true;
this.isStartCook = false;
this.isOnHeatPlate = false;
this.downPositionX;
this.downPositionY;
Phaser.Sprite.call(this, game, meatPlate.x, meatPlate.y, 'meat1');
this.anchor.set(0.5);
this.scale.set(0.5);
this.smoothed = false;
this.inputEnabled = true;
this.input.enableDrag();
this.events.onInputDown.add(this.onDown, this);
this.events.onInputUp.add(this.onUp, this);
// this.events.onDragStart.add(this.onDragStart, this);
// this.events.onDragStop.add(this.onDragStop, this);
game.add.existing(this);
}
Meat.prototype = Object.create(Phaser.Sprite.prototype);
Meat.prototype.constructor = Meat;
Meat.prototype.update = function() {
var positionY = this.y;
if(positionY <= godPositionY)
this.scale.set(0.4);
else if(positionY > godPositionY && positionY < heatPlatePositionY) {
var scaleRate = (positionY - godPositionY) / (heatPlatePositionY - godPositionY);
this.scale.set(0.4 + 0.3 * scaleRate);
} else
this.scale.set(0.4 + 0.3);
// if(this.isOnHeatPlate == true) {
if(this.isOnHeatPlate == true && game.input.mousePointer.isUp == true) {
this.cooking();
}
}
Meat.prototype.onDown = function(sprite, pointer) {
// console.log("onDown : " + pointer.x + ", " + pointer.y);
this.downPositionX = Math.floor(sprite.x);
this.downPositionY = Math.floor(sprite.y);
}
Meat.prototype.onUp = function(sprite, pointer) {
// console.log("onUp : " + pointer.x + ", " + pointer.y);
var upPositionX = Math.floor(sprite.x);
var upPositionY = Math.floor(sprite.y);
if(this.isInClickArea(this.downPositionX, this.downPositionY, upPositionX, upPositionY) == true)
this.onClickListener();
else {
this.onDragStopListener();
// console.log("downPositionX : + " + this.downPositionX + ", downPositY : " + this.downPositionY);
// console.log("upPositionX : + " + upPositionX + ", upPositionY : " + upPositionY);
}
}
/*
Meat.prototype.onDragStart = function(sprite, pointer) {
// console.log("onDragStart : " + pointer.x + ", " + pointer.y);
console.log("onDragStart");
this.stopCook();
}
Meat.prototype.onDragStop = function(sprite, pointer) {
// console.log("onDragStop : " + pointer.x + ", " + pointer.y);
console.log("onDragStop");
if(isOverHeatPlate(this.x, this.y, this.width, this.height) == true) {
console.log("isOverHeatPlate : " + isOverHeatPlate(this.x, this.y, this.width, this.height));
this.startCook();
} else {
this.stopCook();
}
if(isOverGod(this.x, this.y) == true) {
console.log("isOverGod : " + isOverGod(this.x, this.y));
godEatMeat(this);
}
}
*/
Meat.prototype.isInClickArea = function(downX, downY, upX, upY) {
if(downX - 5 < upX && upX < downX + 5 && downY - 5 < upY && upY < downY + 5)
return true;
return false;
}
Meat.prototype.onClickListener = function(pointer) {
console.log("onClick");
if(isOverHeatPlate(this.x, this.y, this.width, this.height) == true) {
if(this.isFront() == true)
this.flipToBack()
else
this.flipToFront();
// console.log("flip cooking side : " + this.cookingSide);
this.animateSmoke(DONENESS_NONE);
}
}
Meat.prototype.onDragStopListener = function(pointer) {
// console.log("onDragStop");
if(isOverHeatPlate(this.x, this.y, this.width, this.height) == true) {
// console.log("isOverHeatPlate : " + isOverHeatPlate(this.x, this.y, this.width, this.height));
this.startCook();
} else {
this.stopCook();
}
if(isOverGod(this.x, this.y) == true) {
// console.log("isOverGod : " + isOverGod(this.x, this.y));
godEatMeat(this);
}
}
Meat.prototype.setScale = function(size) {
this.scale.set(size);
this.backupScale = size;
}
Meat.prototype.isFront = function() {
if(this.cookingSide == MEAT_BACK)
return true;
return false;
}
Meat.prototype.flipToFront = function() {
this.cookingSide = MEAT_BACK;
this.angle = ANGLE_FRONT;
// console.log("flipToFront");
// console.log("back : " + this.getMeatGradeBySide(MEAT_BACK) + ", front : " + this.getMeatGradeBySide(MEAT_FRONT));
if(this.getMeatGradeBySide(MEAT_FRONT) == DONENESS_BURN_BLACK) {
this.loadTexture('meatBurn1');
} else if(this.getMeatGradeBySide(MEAT_FRONT) == DONENESS_WELLDONE) {
this.loadTexture('meatWellDone1');
} else {
this.loadTexture('meat1');
}
}
Meat.prototype.flipToBack = function() {
this.cookingSide = MEAT_FRONT;
this.angle = ANGLE_BACK;
// console.log("flipToBack");
// console.log("back : " + this.getMeatGradeBySide(MEAT_BACK) + ", front : " + this.getMeatGradeBySide(MEAT_FRONT));
if(this.getMeatGradeBySide(MEAT_BACK) == DONENESS_BURN_BLACK) {
this.loadTexture('meatBurn1');
} else if(this.getMeatGradeBySide(MEAT_BACK) == DONENESS_WELLDONE) {
this.loadTexture('meatWellDone1');
} else {
this.loadTexture('meat1');
}
}
Meat.prototype.show = function() {
this.isActivated = true;
this.alpha = 1;
}
Meat.prototype.hide = function() {
this.isActivated = false;
this.alpha = 0;
}
Meat.prototype.startCook = function() {
this.isStartCook = true;
this.isOnHeatPlate = true;
this.flipToFront();
this.animateSmoke(DONENESS_NONE);
}
Meat.prototype.stopCook = function() {
this.isOnHeatPlate = false;
}
Meat.prototype.getMeatGrade = function() {
if(this.cookingGrade[MEAT_FRONT] == DONENESS_WELLDONE && this.cookingGrade[MEAT_BACK] == DONENESS_WELLDONE)
return DONENESS_WELLDONE;
else if(this.cookingGrade[MEAT_FRONT] == DONENESS_BURN_BLACK || this.cookingGrade[MEAT_BACK] == DONENESS_BURN_BLACK)
return DONENESS_BURN_BLACK;
else
return DONENESS_RARE;
}
Meat.prototype.getMeatGradeBySide = function(cookingSide) {
return this.cookingGrade[cookingSide];
}
Meat.prototype.setActive = function(isActivated, x, y, meat_type) {
this.isActivated = isActivated;
if(isActivated == false) {
this.alpha = 0;
this.x = -100;
this.y = -100;
return;
}
this.cookingSide = MEAT_BACK;
this.cookingTime[MEAT_BACK] = 0;
this.cookingTime[MEAT_FRONT] = 0;
this.cookingGrade[MEAT_BACK] = DONENESS_RARE;
this.cookingGrade[MEAT_FRONT] = DONENESS_RARE;
this.x = x;
this.y = y;
this.loadTexture('meat1');
this.angle = ANGLE_NONE;
this.alpha = 1;
}
Meat.prototype.cooking = function() {
this.cookingTime[this.cookingSide] += 1;
// console.log("back : " + this.cookingTime[MEAT_BACK] + ", front : " + this.cookingTime[MEAT_FRONT]);
if(this.cookingTime[MEAT_BACK] > COOK_TIME_BURN) {
if(this.getMeatGradeBySide(MEAT_BACK) != DONENESS_BURN_BLACK) {
this.cookingGrade[MEAT_BACK] = DONENESS_BURN_BLACK;
this.animateSmoke(DONENESS_BURN_BLACK);
}
} else if(this.cookingTime[MEAT_BACK] > COOK_TIME_WELLDONE) {
if(this.getMeatGradeBySide(MEAT_BACK) != DONENESS_WELLDONE) {
this.cookingGrade[MEAT_BACK] = DONENESS_WELLDONE;
this.animateSmoke(DONENESS_WELLDONE);
}
}
if(this.cookingTime[MEAT_FRONT] > COOK_TIME_BURN) {
if(this.getMeatGradeBySide(MEAT_FRONT) != DONENESS_BURN_BLACK) {
this.cookingGrade[MEAT_FRONT] = DONENESS_BURN_BLACK;
this.animateSmoke(DONENESS_BURN_BLACK);
}
} else if(this.cookingTime[MEAT_FRONT] > COOK_TIME_WELLDONE) {
if(this.getMeatGradeBySide(MEAT_FRONT) != DONENESS_WELLDONE) {
this.cookingGrade[MEAT_FRONT] = DONENESS_WELLDONE;
this.animateSmoke(DONENESS_WELLDONE);
}
}
}
Meat.prototype.animateSmoke = function(type) {
var smokeEffect = new Smoke(game, this.x + game.rnd.integerInRange(-50, 0), this.y);
if(type == DONENESS_WELLDONE)
smokeEffect.tint = 0xff3333;
else if(type == DONENESS_BURN_BLACK)
smokeEffect.tint = 0x333333;
}
+45
View File
@@ -0,0 +1,45 @@
/////////////////////////////
// PlusScore Class
PlusScore = function(backupX, backupY, scoreValue) {
var textStyle = { font: "normal 24px Arial", fill: "#ff0", boundsAlignH: "center", boundsAlignV: "middle" };
Phaser.Text.call(this, game, backupX, backupY, "+" + scoreValue);
this.anchor.set(0.5);
// console.log(this);
// this.addColor("#ffffff", 0);
// this.setStyle(textStyle);
var grd = this.context.createLinearGradient(0, 0, 0, this.height);
grd.addColorStop(0, '#8ED6FF');
grd.addColorStop(1, '#004CB3');
this.fill = grd;
// this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.stroke = '#fff';
this.strokeThickness = 5;
// this.addStrokeColor('#f00', 13);
this.inputEnabled = false;
game.time.events.add(Phaser.Timer.SECOND * 1, this.fadePlusScore, this);
game.time.events.add(Phaser.Timer.SECOND * 2, this.destroySelf, this);
game.add.existing(this);
}
PlusScore.prototype = Object.create(Phaser.Text.prototype);
PlusScore.prototype.constructor = PlusScore;
PlusScore.prototype.update = function() {
this.y -= 0.3;
}
PlusScore.prototype.fadePlusScore = function() {
game.add.tween(this).to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true);
}
PlusScore.prototype.destroySelf = function() {
this.destroy();
}
+37
View File
@@ -0,0 +1,37 @@
var SMOKE_START_OFFSET_Y = 200;
var SMOKE_SPEED = 1;
/////////////////////////////
// PlusScore Class
Smoke = function(game, x, y) {
Phaser.Sprite.call(this, game, x, y - SMOKE_START_OFFSET_Y, 'smoke');
// this.anchor.set(0.5);
this.scale.set(0.5);
// console.log(this);
// this.addColor("#ffffff", 0);
// this.setStyle(textStyle);
this.inputEnabled = false;
game.time.events.add(Phaser.Timer.SECOND * 1, this.fadePlusScore, this);
game.time.events.add(Phaser.Timer.SECOND * 2, this.destroySelf, this);
game.add.existing(this);
}
Smoke.prototype = Object.create(Phaser.Sprite.prototype);
Smoke.prototype.constructor = Smoke;
Smoke.prototype.update = function() {
this.y -= SMOKE_SPEED;
}
Smoke.prototype.fadePlusScore = function() {
game.add.tween(this).to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true);
}
Smoke.prototype.destroySelf = function() {
this.destroy();
}
+63
View File
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>고기 굽기</title>
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/lib/session_storage_manager.js"></script>
<script src="../../game/lib/score_manager.js"></script>
<script src="../../game/lib/heart_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/keyboard_shortcut.js"></script>
<script src="../../game/lib/number_util.js"></script>
<script src="../../game/lib/history_record_manager.js"></script>
<script src="../../game/lib/input_type_text.js"></script>
<script src="../../game/lib/score_board.js"></script>
<script src="../../game/lib/score_text.js"></script>
<script src="../../game/lib/heart_gauge.js"></script>
<script src="../../game/lib/button/round_rect_button.js"></script>
<script src="../../game/lib/button/back_button.js"></script>
<script src="../../game/lib/button/fullscreen_button.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/screen_top_ui.js"></script>
<script src="../../game/lib/screen_bottom_ui.js"></script>
<script src="../../game/lib/experience_app_timer.js"></script>
<script src="../../game/lib/game_over_text.js"></script>
<script src="../../game/lib/stage_timer.js"></script>
<!-- Space Invaders : source files -->
<script src="../../game/mouse/grilled_meat/loading.js"></script>
<script src="../../game/mouse/grilled_meat/god.js"></script>
<script src="../../game/mouse/grilled_meat/smoke.js"></script>
<script src="../../game/mouse/grilled_meat/meat.js"></script>
<script src="../../game/mouse/grilled_meat/plus_score.js"></script>
<script src="../../game/mouse/grilled_meat/game.js"></script>
<script src="../../game/mouse/grilled_meat/main.js"></script>
<style>
body{
padding: 0;
margin: 0;
}
canvas{
margin: 0 auto;
}
</style>
</head>
<body>
<div id="Grilled Meat" style="text-align:center;" />
</body>
</html>
+4 -3
View File
@@ -38,7 +38,8 @@ INSERT INTO `app` (`AppID`, `AppName`, `KoreanName`, `AppType`, `Status`, `HowTo
(36, 'test_english_right_lower', 'Right lower', 12, 1, ''), (36, 'test_english_right_lower', 'Right lower', 12, 1, ''),
(39, 'test_english_word', 'Word test', 12, 1, '단어를 빠르게 입력하세요.'), (39, 'test_english_word', 'Word test', 12, 1, '단어를 빠르게 입력하세요.'),
(40, 'test_english_sentence', 'Sentence test', 12, 1, '문장을 빠르게 입력하세요.'), (40, 'test_english_sentence', 'Sentence test', 12, 1, '문장을 빠르게 입력하세요.'),
(50, 'typing_korean_whac_a_mole', '두더지 잡기', 50, 0, '두더지가 나온 키의 글자를 정확하게, 빨리 눌러 잡으세요.\n(한글)'), (50, 'typing_korean_whac_a_mole', '두더지 잡기', 50, 0, '두더지가 나온 키의 글자를\\n정확하고 빠르게 눌러 잡으세요.\\n(한글)'),
(51, 'typing_english_whac_a_mole', 'Whac A Mole', 50, 0, '두더지가 나온 키의 글자를 정확하게, 빨리 눌러 잡으세요.\n(영문)'), (51, 'typing_english_whac_a_mole', 'Whac A Mole', 50, 0, '두더지가 나온 키의 글자를\\n정확하고 빠르게 눌러 잡으세요.\\n(영문)'),
(101, 'space_invaders', '외계인 침공', 100, 1, '외계인이 나타났다!\\n마우스 왼쪽 버튼으로\\n외계인을 클릭해서 물리쳐 주세요.'), (101, 'space_invaders', '외계인 침공', 100, 1, '외계인이 나타났다!\\n마우스 왼쪽 버튼을 클릭해서\\n외계인이 사라지기 전에 물리쳐 주세요.'),
(102, 'card_matching', '카드 짝 맞추기', 100, 0, '같은 그림의 카드를 맞춰주세요.'); (102, 'card_matching', '카드 짝 맞추기', 100, 0, '같은 그림의 카드를 맞춰주세요.');
(103, 'grilled_meat', '고기 굽기', 100, 0, '고기를 드래그해서 불판에 울려 구워볼게요.\\n잘 익은 연기가 올라오면 클릭해서 뒤집어주시고요.\\n고기를 맛있게 구워졌나요? 그럼 할아버지한테 먹여주세요.');