(function() { "use strict"; var MenuScene = function() { this.initialize(); } var p = MenuScene.prototype = new creatine.Scene(); p.Scene_initialize = p.initialize; p.ship = null; p.initialize = function() { this.Scene_initialize(); this.ship = new createjs.Bitmap(loader.getResult('ship')); this.ship.regX = this.ship.image.width/2; this.ship.regY = this.ship.image.height/2; this.ship.x = canvas.width/2; this.ship.y = 135; this.addChild(this.ship); this.shadow = new createjs.Bitmap(loader.getResult('shadow')); this.shadow.y = 150; this.addChild(this.shadow); this.txtTitle = new createjs.Text('Beneath The Sea', '36px montserrat', SCREEN_TEXT_DARKCOLOR); this.txtTitle.textAlign = 'center'; this.txtTitle.x = canvas.width/2; this.addChild(this.txtTitle); this.buttonMute = new createjs.Bitmap(loader.getResult('button_mute')); this.buttonMute.on('click', this.onButtonMute, this); this.buttonMute.x = 320; this.buttonMute.y = 10; this.addChild(this.buttonMute); this.buttonStart = new createjs.Bitmap(loader.getResult('button_start')); this.addChild(this.buttonStart); this.buttonCredits = new createjs.Bitmap(loader.getResult('button_credits')); this.addChild(this.buttonCredits); this.txtHighScore = new createjs.Text('High Score', '24px montserrat', '#fee9ce'); this.txtHighScore.textAlign = 'center'; this.addChild(this.txtHighScore); var score = paddingString(localStorage['btsHighScore'], "000000"); this.txtScore = new createjs.Text(score, '36px montserrat', '#fee9ce'); this.txtScore.textAlign = 'center'; this.addChild(this.txtScore); this.buttonGuineaLink = new createjs.Text('http://guineashots.com', '16px montserrat', '#fee9ce'); this.buttonGuineaLink.textAlign = 'center'; this.buttonGuineaLink.on('click', this.onGuineaLink, this); this.addChild(this.buttonGuineaLink); var area = {x:0, y:0, width:canvas.width, height:canvas.height} var vbox = new creatine.BoxSizer(creatine.VERTICAL, area); vbox.add({}, 8, 0); vbox.add(this.txtTitle, 1, 0); vbox.add({}, 2, 0); vbox.add(this.buttonStart, 4, 0, creatine.CENTER); vbox.add(this.buttonCredits, 4, 0, creatine.CENTER); vbox.add({}, 1, 0); vbox.add(this.txtHighScore, 1, 0, creatine.CENTER); vbox.add({}, 0.5, 0); vbox.add(this.txtScore, 1, 0, creatine.CENTER); vbox.add({}, 1, 0); vbox.add(this.buttonGuineaLink, 1, 25, creatine.BOTTOM); vbox.layout(); var hc = canvas.width/2; this.txtHighScore.x = hc; this.txtScore.x = hc; this.buttonGuineaLink.x = hc; this.txtTitle.x = hc; this.on('sceneenter', this.onSceneEnter); } p.onUpdate = function(event) { } p.onButtonStart = function(event) { this.buttonStart.removeAllEventListeners('click'); this.buttonCredits.removeAllEventListeners('click'); director.replace( new LevelScene(), new creatine.transitions.Scroll( creatine.LEFT, createjs.Ease.cubicInOut, 800 ) ); } p.onButtonCredits = function(event) { this.buttonStart.removeAllEventListeners('click'); this.buttonCredits.removeAllEventListeners('click'); director.replace( new CreditsScene(), new creatine.transitions.Scroll( creatine.LEFT, createjs.Ease.cubicInOut, 800 ) ); } p.onGuineaLink = function(event) { window.open('http://guineashots.com','_blank'); } p.onButtonMute = function(event) { var vol = createjs.Sound.getVolume(); if (vol === 0) { createjs.Sound.setVolume(1); localStorage['btsSoundVolume'] = 1; } else { createjs.Sound.setVolume(0); localStorage['btsSoundVolume'] = 0; } } p.onSceneEnter = function(event) { this.buttonStart.on('click', this.onButtonStart, this); this.buttonCredits.on('click', this.onButtonCredits, this); if (!registry.gameMusic || registry.gameMusic.name !== 'music_menu') { if (registry.gameMusic) { registry.gameMusic.stop(); } registry.gameMusic = createjs.Sound.play('music_menu', 'none', 0, 0, -1, VOLUME_MUSIC); registry.gameMusic.name = 'music_menu'; } } window.MenuScene = MenuScene; }());