Add: Chocoball onClick event handler

This commit is contained in:
2019-05-10 07:49:04 +09:00
parent 413400dfda
commit c87308f604
2 changed files with 43 additions and 28 deletions
+15 -15
View File
@@ -4,8 +4,6 @@ var Game = {
this.dbConnectManager = new DBConnectManager();
sessionStorageManager.setRecord(0);
this.game.stage.backgroundColor = "#000000"; // '#4d4d4d';
sessionStorageManager.setIsNewAppHighestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
@@ -22,28 +20,19 @@ var Game = {
"1 to 50" // callerClassName
);
// game stage
game.stage.backgroundColor = '#4d4d4d';
// top ui
var screenTopUI = new ScreenTopUI();
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
screenTopUI.makeFullScreenButton();
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);
}
// init game elements
this.initVariables();
// game stage
game.stage.backgroundColor = '#4d4d4d';
graphics = game.add.graphics(0, 0);
// bottom ui
var screenBottomUI = new ScreenBottomUI();
@@ -57,6 +46,12 @@ var Game = {
},
initVariables: function() {
this.chocoballs = new Array();
for(var i = 0; i < 25; i++) {
var chocoball = new Chocoball(i, this.onClickChocoball);
chocoball.setNumber(i);
this.chocoballs.push(chocoball);
}
},
back: function() {
@@ -65,6 +60,11 @@ var Game = {
},
onClickChocoball: function(chocoball) {
console.log(chocoball.index);
},
startGame: function() {
this.stopWatch.start();
},