(function() { "use strict"; var IntroScene = function() { this.initialize(); } var p = IntroScene.prototype = new creatine.Scene(); p.Scene_initialize = p.initialize; p.ship = null; p.creeps = null; p.boss = 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.boss = new createjs.Bitmap(loader.getResult('ktulu')); this.boss.regX = this.boss.image.width/2; this.boss.regY = this.boss.image.height/2; this.boss.x = 182; this.boss.y = 600; this.boss.alpha = 0; this.addChild(this.boss); this.txtTitle = new createjs.Text('Beneath The Sea', '48px montserrat', SCREEN_TEXT_LIGHTCOLOR); this.txtTitle.textAlign = 'center'; this.txtTitle.x = canvas.width/2; this.txtTitle.y = canvas.height/2-20; this.txtTitle.alpha = 0; this.addChild(this.txtTitle); this.shadow = new createjs.Bitmap(loader.getResult('shadow')); this.shadow.y = 150; this.addChild(this.shadow); this.startIntro(); stage.on('stagemousedown', this.onClick, this); } p.startIntro = function() { var _this = this; this.sound = createjs.Sound.play('sound_ktulu', 'none', 1000, 0, 0, VOLUME_SFX); createjs.Tween.get(this.txtTitle) .wait(1000) .to({alpha:1}, 3000) .wait(2000) .to({alpha:0}, 1500); this.animation = createjs.Tween.get(this.boss) .wait(1000) // .call(function() {}) .to({y:458, alpha:1}, 3000) .wait(2000) .to({y:600, alpha:0}, 1500) .wait(500) .call(function() { _this.stopIntro(); }); } p.stopIntro = function() { stage.removeAllEventListeners('stagemousedown'); this.animation.setPaused(true); this.sound.stop(); director.replace( new MenuScene(), new creatine.transitions.Scroll( creatine.LEFT, createjs.Ease.cubicInOut, 800 ) ); } p.onClick = function(event) { this.stopIntro(); } p.onUpdate = function(event) { } window.IntroScene = IntroScene; }());