diff --git a/resources/image/object/one_to_fifty/choco_body.png b/resources/image/object/one_to_fifty/choco_body.png new file mode 100644 index 0000000..663e002 Binary files /dev/null and b/resources/image/object/one_to_fifty/choco_body.png differ diff --git a/resources/image/object/one_to_fifty/choco_gloss.png b/resources/image/object/one_to_fifty/choco_gloss.png new file mode 100644 index 0000000..89df167 Binary files /dev/null and b/resources/image/object/one_to_fifty/choco_gloss.png differ diff --git a/resources/image/object/one_to_fifty/one_to_fifty.afdesign b/resources/image/object/one_to_fifty/one_to_fifty.afdesign new file mode 100644 index 0000000..385c5a3 Binary files /dev/null and b/resources/image/object/one_to_fifty/one_to_fifty.afdesign differ diff --git a/src/game/mouse/one_to_fifty/chocoball.js b/src/game/mouse/one_to_fifty/chocoball.js new file mode 100644 index 0000000..de6cee1 --- /dev/null +++ b/src/game/mouse/one_to_fifty/chocoball.js @@ -0,0 +1,75 @@ +// Chocoball.prototype = Object.create(Phaser.Sprite.prototype); +// Chocoball.constructor = Chocoball; + +function Chocoball(index) { + this.isActivated = false; + + this.row = Math.floor(index / 5); + this.col = index % 5; + + var x = 200 + this.col * 100; + var y = 200 + this.row * 100; + this.body = game.add.sprite(x, y, 'choco_body'); + this.body.scale.set(1); + this.body.anchor.set(0.5); + this.body.tint = 0xff0000; + + this.gloss = game.add.sprite(x, y, 'choco_gloss'); + this.gloss.scale.set(1); + this.gloss.anchor.set(0.5); + + this.number = this.makeNumber("50"); + this.body.addChild(this.number); + + // game.add.existing(this); + // game.physics.arcade.enable(this); + + // this.halfWidth = this.width / 2; + + this.setActive(true); +} + +Chocoball.prototype.makeNumber = function(textContent) { + var width = 0; + var height = this.width / 30; + + var number = game.add.text(width, height, textContent, Chocoball.FONT_STYLE); + number.anchor.set(0.5); + number.lineSpacing = Chocoball.DEFAULT_TEXT_LINE_SPACING_PX; + + return number; +} + +Chocoball.prototype.setNumber = function(number) { + this.number.text = number; +} + + +Chocoball.prototype.setActive = function(isActivated) { + this.isActivated = isActivated; +} + +Chocoball.loadResources = function() { + game.load.image('choco_gloss', '../../../resources/image/object/one_to_fifty/choco_gloss.png'); + game.load.image('choco_body', '../../../resources/image/object/one_to_fifty/choco_body.png'); +} + + +// Chocoball.DEFAULT_SPEED = 400; + +Chocoball.IMAGE_SIZE = 90; +Chocoball.IMAGE_CENTER = Chocoball.IMAGE_SIZE / 2; + +Chocoball.FONT_STYLE = { + font: "50px Arial", + boundsAlignH: "center", // left, center. right + boundsAlignV: "middle", // top, middle, bottom + fill: "#fff", + fontWeight: "bold", + stroke: "rgba(0, 0, 0, 0.5)", // "#333", // "#000", + strokeThickness: 8, + align: "center" +}; + +Chocoball.DEFAULT_TEXT_LINE_SPACING_PX = -10; // in pixel +Chocoball.DEFAULT_STROKE_WIDTH_PX = 5; // in pixel diff --git a/src/game/mouse/one_to_fifty/game.js b/src/game/mouse/one_to_fifty/game.js index 28f388e..8f3a857 100644 --- a/src/game/mouse/one_to_fifty/game.js +++ b/src/game/mouse/one_to_fifty/game.js @@ -30,6 +30,14 @@ var Game = { this.stopWatch = new StopWatch(game); + this.chocoballs = new Array(); + for(var i = 0; i < 25; i++) { + var chocoball = new Chocoball(i); + chocoball.setNumber(i); + this.chocoballs.push(chocoball); + } + + this.initVariables(); // game stage diff --git a/src/game/mouse/one_to_fifty/loading.js b/src/game/mouse/one_to_fifty/loading.js index 3345c76..56a90d8 100644 --- a/src/game/mouse/one_to_fifty/loading.js +++ b/src/game/mouse/one_to_fifty/loading.js @@ -34,6 +34,8 @@ var Loading = { game.load.image('card_front', '../../../resources/image/ui/card_front.png'); game.load.image('card_edge', '../../../resources/image/ui/card_selected.png'); + Chocoball.loadResources(); + // 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'); diff --git a/src/web/client/onetofifty.html b/src/web/client/onetofifty.html index 99683fa..67491fe 100644 --- a/src/web/client/onetofifty.html +++ b/src/web/client/onetofifty.html @@ -66,6 +66,7 @@ +