function create(){
this.add.image(1024/2, 768/2, 'bg_start');
var btnPlay = this.add.image(1024/2, 768/2 + 75, 'btn_play');
btnPlay.setDepth(10);
this.titleGame = this.add.image(1024/2, 200, 'title_game');
this.titleGame.setDepth(10);
this.titleGame.y -= 384;
var diz = this;
this.tweens.add({
targets: diz.titleGame,
ease: 'Bounce.easeOut',
duration: 750,
delay: 250,
y: 200
});
this.titleGame.setScale(0);
this.tweens.add({
targets: diz.titleGame,
ease: 'Elastic',
duration: 750,
delay:1000,
scaleX:1,
scaleY:1
});
btnPlay.setScale(0);
this.tweens.add({
targets: btnPlay,
ease: 'Back',
duration: 500,
delay: 750,
scaleX : 1,
scaleY : 1
});
btnPlay.setInteractive();
var btnCliked = false;
this.input.on('gameobjectover', function (pointer, gameObject) {
console.log("Scene Menu | Object Over");
if (!btnCliked) return;
if (gameObject == btnPlay) {
btnPlay.setTint(0x616161);
}
}, this);
this.input.on('gameobjectout', function (pointer, gameoObject) {
console.log("Scene Menu | Object Out");
if (!btnCliked) return;
if (gameoObject == btnPlay) {
btnPlay.setTint(0xffffff);
}
}, this);
this.input.on('gameobjectdown', function (pointer, gameObject) {
console.log("Scene Menu | Object Click");
if (gameObject == btnPlay) {
btnPlay.setTint(0x616161);
btnCliked = true;
}
}, this);
this.input.on('gameobjectup', function (pointer, gameObject) {
console.log("Scene Menu | Object End Click");
if (gameObject == btnPlay) {
btnPlay.setTint(0xffffff);
this.scene.start('scnPlay');
}
}, this);
this.input.on('pointerup', function(pointer, currentlyOver) {
console.log("Scene Menu | Mouse Up");
btnCliked = false;
}, this);
}