(function() { "use strict"; var CreditsScene = function() { this.initialize(); } var p = CreditsScene.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_bg')); this.title = new createjs.Bitmap(loader.getResult('img_credits')); var bounds = this.title.getBounds(); this.title.regX = bounds.width/2; this.title.regY = bounds.height/2; this.title.x = canvas.width/2; this.title.y = 130; this.buttonBack = new Button('Back'); var bounds = this.buttonBack.getBounds(); this.buttonBack.regX = bounds.width/2; this.buttonBack.regY = bounds.height/2; this.buttonBack.x = canvas.width/2; this.buttonBack.y = canvas.height-50; this.buttonGuineaLink = new createjs.Text('http://guineashots.com', '24px sheep', '#333'); var AUTHOR = 'Renato de Pontes Pereira'; var CREDITS = ''+ '\n' + 'A game created for Ludum Dare 31 - The Entire game ' + 'on One Screen. \n\n' + '. \n'+ 'Herd the sheep to their final destination, but be ' + 'careful! Don\'t let anything bad happen to the ' + 'little sheeps.'; this.txtAuthor = new createjs.Text('by '+AUTHOR, '24px sheep', '#333'); // this.txtAuthor.textAlign = 'right'; this.txtAuthor.lineWidth = canvas.width/1.5; this.txtCredits = new createjs.Text(CREDITS, '22px Arial', '#333'); // this.txtCredits.textAlign = 'justify'; this.txtCredits.lineWidth = canvas.width/1.5; var area = {x:0, y:0, width:canvas.width, height:canvas.height} var vbox = new creatine.BoxSizer(creatine.VERTICAL, area); vbox.add({}, 15, 0); vbox.add(this.txtCredits, 3, 0, creatine.CENTER); vbox.add({}, 4, 0); vbox.add(this.txtAuthor, 1, 0, creatine.CENTER); vbox.add(this.buttonGuineaLink, 1, 0, creatine.CENTER); vbox.add({}, 6, 0); vbox.layout(); this.txtAuthor.x += 120; this.buttonGuineaLink.x += 150; // add objects to scene this.addChild(this.background); this.addChild(this.title); this.addChild(this.buttonBack); this.addChild(this.txtAuthor); this.addChild(this.txtCredits); 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.buttonBack.on('click', this.onButtonBack, this); this.txtAuthor.on('click', this.onGuineaLink, this); this.buttonGuineaLink.on('click', this.onGuineaLink, this); } p.unregisterEvents = function(event) { this.buttonBack.removeAllEventListeners('click'); this.txtAuthor.removeAllEventListeners('click'); this.buttonGuineaLink.removeAllEventListeners('click'); } p.onUpdate = function(event) { // this.title.rotation += 20*event.fdelta; } 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.onButtonBack = function(event) { director.pop( new creatine.transitions.Scroll(creatine.RIGHT) ); } window.CreditsScene = CreditsScene; }());