Changeset 6216 for 2015/26


Ignore:
Timestamp:
2015-06-23 22:33:21 (8 years ago)
Author:
jotapoti
Message:

better intro sequence

Location:
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs

    r6215 r6216  
    9191    public override void Begin() 
    9292    { 
    93         //IntroSequence(); 
     93        IntroSequence(); 
    9494        //MainMenu(); 
    95         StartGame(); 
     95        //StartGame(); 
    9696    } 
    9797 
     
    101101        Level.Background.Color = Color.Black; 
    102102 
     103        Keyboard.Listen(Key.Escape, ButtonState.Pressed, SkipIntro, "Skip"); 
     104         
     105        ShowMadeWithJypeli(); 
     106 
     107        Timer.SingleShot(4.0, delegate // TODO get rid of fixed amount of seconds 
     108        { 
     109            ShowBackgroundStory(); 
     110        }); 
     111         
     112 
     113 
     114    } 
     115 
     116    void ShowMadeWithJypeli() 
     117    { 
     118        Image madewithImage = LoadImage("madewithjypeli"); 
     119         
     120        double w = Window.Width / 4; 
     121        double h = w * (madewithImage.Height / (double)madewithImage.Width); // take aspect ratio from the picture 
     122         
     123        GameObject madewithjypeliObject = new GameObject(w, h); 
     124        madewithjypeliObject.Image = madewithImage; 
     125        Add(madewithjypeliObject); 
     126 
     127        // Tässä oli jotain epätehokasta feidailua tuolle Made with Jypeli -kuvalle. Ei tunnu päivittyvän joka framella tai on muuten vain tosi raskas... 
     128 
     129        //fadeTimer = new Timer(); 
     130        //fadeTimer.Interval = 0.5; 
     131        //fadeTimer.Timeout += delegate 
     132        //{ 
     133        //    madewithjypeliObject.Image = LerpImage(madewithjypeliObject.Image, Color.Black, 0.6); 
     134        //}; 
     135        //fadeTimer.Start(5); 
     136         
     137        Timer.SingleShot(1.2, delegate 
     138        { 
     139            madewithjypeliObject.Destroy(); 
     140        }); 
     141 
     142    } 
     143 
     144    Image LerpImage(Image original, Color targetColor, double ratio) 
     145    { 
     146        Image newImage = new Image(original.Width, original.Height, Color.Transparent); 
     147        for (int y = 0; y < original.Height; y++) 
     148        { 
     149            for (int x = 0; x < original.Width; x++) 
     150            { 
     151                newImage[y, x] = Color.Lerp(original[y, x], targetColor, ratio); 
     152            } 
     153        } 
     154        return newImage; 
     155    } 
     156 
     157    void ShowBackgroundStory() 
     158    { 
    103159        Label storyLabel = new Label("Once upon a time..."); 
    104         storyLabel.TextColor = Color.Gray; 
     160        storyLabel.TextColor = Color.Black; 
    105161        Add(storyLabel); 
    106162 
    107163        Timer textTimer = new Timer(); 
    108         textTimer.Interval = 0.5; 
     164        textTimer.Interval = 0.1; 
    109165        textTimer.Timeout += delegate 
    110166        { 
    111             // TODO vaalenna tekstiä näkyville läpinäkyvyyttä tms. säätämällä 
    112              
     167            // lightens text up: 
     168            storyLabel.TextColor = Color.Lerp(storyLabel.TextColor, Color.Gray, 0.1); 
    113169        }; 
    114  
     170        textTimer.Start(); 
    115171        // TODO siirrä aliohjelmaan, jolle voi antaa parametrina stringin, joka näytetään siististi feidaamalla esille 
    116172 
    117  
    118  
    119         // TODO replace this SingleShot with something else. It must be the last thing after the intro sequence 
    120          
     173        // TODO lisää koko pelin tarina usealla feidailevalla tekstinpätkällä esitettynä 
     174 
    121175        // Clean up after the intro: 
    122         Timer.SingleShot(5, delegate 
    123         { 
     176        Timer.SingleShot(5, delegate // TODO get rid of this fixed amount of seconds 
     177        { // TODO replace this SingleShot with something else. It must be the last thing after the intro sequence 
    124178            storyLabel.Destroy(); 
    125179 
     
    129183    } 
    130184 
     185    void SkipIntro() 
     186    { 
     187        ClearTimers(); 
     188        ClearAll(); 
     189        Keyboard.Clear(); 
     190        MainMenu(); 
     191    } 
     192 
    131193    void MainMenu() 
    132194    { 
    133         Level.Background.Color = Color.MediumBlue; 
     195        Level.Background.Color = Color.DarkBlue; 
    134196 
    135197        MultiSelectWindow mainmenu = new MultiSelectWindow("Main menu", 
     
    218280        level.SetTileMethod(Color.White, CreateBlockObject);  
    219281        level.SetTileMethod(Color.DarkGray, CreateMilk);    
    220         level.SetTileMethod(Color.Gray, CreateCrawly);   
     282        level.SetTileMethod(Color.Gray, CreateCrawly); 
    221283        level.SetTileMethod(Color.Red, CreateDummy, Color.Red);    //TODO: CreateWitch 
    222284        level.SetTileMethod(Color.Rose, CreateFlame);    
     
    396458        bool wheat = probability < 20; 
    397459 
    398         if(wheat) 
     460        if (wheat) 
    399461        { 
    400462            GameObject wheatBlock = new GameObject(width * 1.5, height * 3); 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj

    r6213 r6216  
    108108  </ItemGroup> 
    109109  <ItemGroup> 
     110    <Compile Include="madewithjypeli.png"> 
     111      <Name>madewithjypeli</Name> 
     112      <Importer>TextureImporter</Importer> 
     113      <Processor>TextureProcessor</Processor> 
     114    </Compile> 
     115  </ItemGroup> 
     116  <ItemGroup> 
    110117    <Compile Include="crawl.anim"> 
    111118      <Name>crawl</Name> 
Note: See TracChangeset for help on using the changeset viewer.