Advertisement
Guest User

intro.js

a guest
Jun 19th, 2015
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Revel Immortal - The Continued Story of Morning's Wrath
  2. //Copyright 2001-2013 Ethereal Darkness Interactive
  3. //All Rights Reserved Worldwide
  4.  
  5. function Intro(game)
  6. {
  7.     this.game=game;
  8.     this.tween=new Tween();
  9.     this.listings=[
  10.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"Five years had passed since the assault on castle Iridine."},
  11.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"Morning's power had diminished, and with it her wroth and want of revenge."},
  12.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"A drink from the great mana well had given her the strength to defend her people;"},
  13.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"And though those before her were struck with madness, or death;\nshe showed no ill effect... save one."},
  14.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"It was found from that day forward no longer did Morning want for food, or drink; or sleep."},
  15.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"...it seemed no device of man would harm her."},
  16.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"...Princess Morning had become Immortal."},
  17.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"Though as the eastern lands of the Leowyn people were rocked\nby the reawakening of magic within the halls of Iridine;"},
  18.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"...still most of the world slept unchanged."},
  19.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"...but not in the land of Ashidia."},
  20.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"Undaunted by their defeat on summerfound, the lords of Ashidia grew only more desperate."},
  21.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"They enslaved the free peoples of their realm to bolster the ranks of their armies."},
  22.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"But worse still, countless men, women and children were sent underground;\nto delve for that the Ashidian lords craved most."},
  23.         {fadeInDuration: 3 , fadeOutDuration: 5 , text:"A mana wellspring of their own."},
  24.         {fadeInDuration: 3 , fadeOutDuration: 10 , text:"...but in the dark, they came upon a far greater evil."}
  25.         //{fadeInDuration: 3 , fadeOutDuration: 5 , text:"It corrupted those trapped within the mines; turning them into crazed warlike creatures."},
  26.         //{fadeInDuration: 3 , fadeOutDuration: 5 , text:"But the lords of Ashidia were pleased; the loss of innocent lives meant little to them;\nwould that these creatures devour their enemies."},
  27.         //{fadeInDuration: 3 , fadeOutDuration: 5 , text:"War was coming for the Leowyn people once again; and Morning would again answer the challenge."}
  28.     ];
  29.     this.alpha=0;
  30. }
  31.  
  32. Intro.prototype=Object.create(Object.prototype);
  33. Intro.prototype.constructor=Intro;
  34.  
  35. Intro.prototype.getPlaylist=function(){
  36.     return "intro";
  37. }
  38.  
  39. Intro.prototype.loaded=function()
  40. {
  41.     var localThis=this;
  42.     this.advanceSlide();
  43. }
  44.  
  45. Intro.prototype.mouse=function(x, y, type)
  46. {
  47.     var localThis=this;
  48.     if(type==0)
  49.     {
  50.         this.game.endView();
  51.     }
  52. }
  53.  
  54. Intro.prototype.update=function(t)
  55. {
  56.     this.tween.update(t);
  57.  
  58. }
  59.  
  60. Intro.prototype.advanceSlide=function()
  61. {
  62.     var localThis=this;
  63.     if(this.listings.length>0)
  64.     {
  65.         localThis.tween.to(localThis, localThis.listings[0].fadeInDuration, {alpha:1}, Ease.inOutExpo, function(){
  66.             localThis.tween.to(localThis, localThis.listings[0].fadeOutDuration, {alpha:0}, Ease.inOutExpo, function(){
  67.                 localThis.listings.shift();
  68.                 localThis.advanceSlide();
  69.             });
  70.         });
  71.     }
  72.     else
  73.     {
  74.         this.game.endView();
  75.     }
  76. }
  77.  
  78. Intro.prototype.render=function(ctx)
  79. {
  80.     ctx.clearRect(0,0,Game.width,Game.height);
  81.     if(this.listings.length>0)
  82.     {
  83.         ctx.font="24px garamond";
  84.         ctx.textAlign="center";
  85.         ctx.fillStyle="#fff";
  86.         ctx.globalAlpha=this.alpha;
  87.         var lines=this.listings[0].text.split("\n");
  88.         for(var i=0;i<lines.length;++i)
  89.         {
  90.             ctx.fillText(lines[i],Game.width/2,(Game.height/4)+i*40);
  91.         }
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement