var MenuScene = tine._scene({ initialize: function() { this.addLayer('background'); this.addLayer('screen'); this.addLayer('ui'); var w = game.canvas.width; var h = game.canvas.height; var wh = game.canvas.width/2; var hh = game.canvas.height/2; this.addObject(game.create.bitmap('img_stars'), 'background'); var sky = game.create.shape({regX:-wh, regY:-hh, alpha:0.7}); sky.graphics .rf(["#1D3A58", "#000"], [0, 1], wh, hh, 0, wh, hh, Math.max(w, h)) .r(0, 0, w, h) this.addObject(sky, 'background'); this.addObject(game.create.bitmap('img_dirt'), 'screen'); this.addObject(game.create.bitmap('img_frame'), 'screen'); this.addObject(game.create.bitmap('img_lens'), 'screen'); var self = this; var button = new Button('Play', function() { self.goLevel() }); button.x = w-125; button.y = h-210; this.addObject(button, 'ui'); button = new Button('Credits', function() { self.goCredits() }); button.x = w-125; button.y = h-140; this.addObject(button, 'ui'); var button = new Button('More', function() { self.goMore() }); button.x = w-125; button.y = h-70; this.addObject(button, 'ui'); logo = game.create.text('Democracy', { font: '72px aero', textAlign: 'center', color: '#E0E0E0', x: wh, y: 70, }); this.addObject(logo, 'ui'); var muteButton = new MiniButton('M', function() { game.sound.toogleMute(); }) muteButton.x = w-60; muteButton.y = 50; this.addObject(muteButton, 'ui'); logo = game.create.text( '\n\n'+ 'Help us to spread democracy through the galaxy\n\n'+ 'Do your part! It is your duty as Citzen\n\n\n\n\n\n\n'+ 'Would you like to know more?\n' // ' DO YOUR PART!\n' , { font: '18px nasa', textAlign: 'justify', color: '#E0E0E0', x: 45, y: 250, }); this.addObject(logo, 'ui'); }, beforeEnter: function() { game.stage.enableMouseOver(); }, beforeExit: function() { game.stage.enableMouseOver(false); }, update: function() { }, exit: function() { this.alpha = 1; }, goLevel: function() { var playedOnce = game.storage.get('playedonce'); if (!playedOnce) { game.director.replace('intro', new tine.transitions.FadeOut(null, 600)); } else { game.director.replace('selection', new tine.transitions.FadeOut(null, 300)); } }, goCredits: function() { game.director.replace('credits', new tine.transitions.FadeOut(null, 300)); }, goMore: function() { window.open('http://guineashots.com','_blank'); } })