(function() { "use strict"; var MenuScene = function() { this.initialize(); } var p = MenuScene.prototype = new creatine.Scene(); p.Scene_initialize = p.initialize; p.initialize = function() { this.Scene_initialize(); // initialize objects this.background = new createjs.Bitmap(loader.getResult('img_menu')); this.buttonStart = createButton(140, 40, 'Start', true); this.buttonCredits = createButton(140, 40, 'Credits', true); this.buttonGuineaLink = new createjs.Text('http://guineashots.com', '32px sweetlove', '#6D4419'); // set layout var area = {x:0, y:0, width:canvas.width, height:canvas.height} var vbox = new creatine.BoxSizer(creatine.VERTICAL, area); vbox.add({}, 3, 0) vbox.add({}, 5, 0); vbox.add({}, 1, 0) vbox.add({}, 1, 0) vbox.add(this.buttonStart, 3, 0, creatine.CENTER); vbox.add(this.buttonCredits, 3, 0, creatine.CENTER); vbox.add({}, 3, 0) vbox.add(this.buttonGuineaLink, 1, 5, creatine.RIGHT) vbox.add({}, 4, 0) vbox.layout(); // add objects to scene this.addChild(this.background); this.addChild(this.buttonStart); this.addChild(this.buttonCredits); this.addChild(this.buttonGuineaLink); // register events this.on('sceneenter', this.onSceneEnter); this.on('sceneresume', this.onSceneResume); this.on('scenepause', this.onScenePause); } p.registerEvents = function(event) { this.buttonStart.on('click', this.onButtonStart, this); this.buttonCredits.on('click', this.onButtonCredits, this); this.buttonGuineaLink.on('click', this.onGuineaLink, this); } p.unregisterEvents = function(event) { this.buttonStart.removeAllEventListeners('click'); this.buttonCredits.removeAllEventListeners('click'); this.buttonGuineaLink.removeAllEventListeners('click'); } p.onUpdate = function(event) { } p.onSceneEnter = function(event) { this.registerEvents(); } p.onSceneResume = function(event) { this.registerEvents(); } p.onScenePause = function(event) { this.unregisterEvents(); } p.onGuineaLink = function(event) { window.open('http://guineashots.com','_blank'); } p.onButtonStart = function(event) { director.replace( new SelectLevelScene(), new creatine.transitions.Scroll(creatine.BOTTOM) ) } p.onButtonCredits = function(event) { director.push( new CreditsScene(), new creatine.transitions.Scroll(creatine.TIGH) ) } window.MenuScene = MenuScene; }());