// Creates Intro panel with information before gameplay Script.include(["pd_utils.js", "pd_hudPanel.js"]); Intro = function() { this.isFinished = false; this.introPanel = this.createIntroPanel(); this.introText = []; this.introText.push("<< INCOMING TRANSMISSION >>\n\nSerik here.\n\n\nDo you copy?"); this.introText.push("Great!\n\nHopefully you've arrived on the surface of the planet, Pomona-1, intact.\n\nOf course, I'm still safely up here in orbit above the planet so don't worry, I've got your back. :)"); this.introText.push("Currently the P.E.A, Pomona-1 Ecological Authority, has authorized only eco-target sampling and counts.\n\nHopefully when we prove that we're the team to get the job done they'll trust a little more.") this.introText.push("You can't really blame them for caution can you?\n\nPomona-1 was racked by brutal resource extraction wars for so many years...\n\nIf I were in charge of restoring ecological balance to this planet I'd be careful who I hired too!"); this.introText.push("I believe our team can help bring this planet back from the brink of ecological collapse. I hope you do too.\n\nThere's plenty of work to be done, and that's why your down there."); this._textIndex = 0; this._presenting = false; } Intro.prototype.createIntroPanel = function() { var frameUrl = pd_path("images/introFrame.png"); var hudPanel = new HudPanel({x:Window.innerWidth/2 - 150, y:130}, {x:300, y:420}, {x:10,y:0}); var titleColor = {red:255, green:255, blue:255}; var spacebarColor = {red:255, green:40, blue:40}; var textColor = {red:40, green:200, blue:40 }; hudPanel.addRectangle("bgRectangle", {x:0, y:0}, hudPanel.size.x, hudPanel.size.y, {red:20, green:20, blue:20} ); hudPanel.addStaticText("lbl_howToPlay", "Eco-Briefing", {x:90, y:50}, hudPanel.size.x, titleColor ); hudPanel.addImageFrame("frame", {x:-23, y:-21}, hudPanel.size.x + 47, hudPanel.size.y + 43, frameUrl ); hudPanel.addDynamicText("mainText", "", {x:0, y:90}, hudPanel.size.x, textColor ); hudPanel.addDynamicText("spaceToContinue", "[ Press Spacebar To Continue ]", {x:35, y:hudPanel.size.y - 30}, hudPanel.size.x, spacebarColor ); return hudPanel; } Intro.prototype.startPresentation = function() { this._textIndex = 0; this.introPanel.setDisplayText("mainText", this.introText[this._textIndex]); this.introPanel.show(); this._presenting = true; this.introPanel.startAnimation(); } Intro.prototype.onKeyPress = function(event) { if (event.key == SPACEBAR_CHARCODE) { this._textIndex++; if (this.introText.length > this._textIndex) { printDebug("Next Intro Block"); this.introPanel.setDisplayText("mainText", this.introText[this._textIndex]); this.introPanel.startAnimation(); } else { this.isFinished = true; this.introPanel.hide(); } } } Intro.prototype.scriptUpdate = function(deltaTime) { this.introPanel.scriptUpdate(deltaTime); } Intro.prototype.deconstruct = function() { this.introPanel.deconstruct(); }