Ignore:
Timestamp:
2010-06-10 14:42:58 (13 years ago)
Author:
kavaisan
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/Kavaisan/Tasohyppely1/Peli.cs

    r655 r679  
    2626        { 
    2727            kenttaNro = 1; 
    28             Level.Width = 2000; 
    29             Level.Height = 1000; 
    30  
     28 
     29            // Zoomataan lähemmäksi 
     30            Camera.ZoomFactor = 2.0; 
     31 
     32            Camera.StayInLevel = true; 
     33 
     34            seuraavaKentta(); 
     35            MessageDisplay.Add("Etsi iso tähti!"); 
     36        } 
     37 
     38        void seuraavaKentta() 
     39        { 
     40            ClearAll(); 
     41 
     42            lisaaPisteLaskuri(); 
     43 
     44            // Asetetaan painovoima 
     45            Gravity = new Vector(0, -1000); 
     46 
     47            luoKentta(); 
     48            kenttaNro++; 
     49            if (kenttaNro > 2) kenttaNro = 1; 
     50 
     51            lisaaNappaimet(); 
     52            Camera.Follow(pelaaja1); 
     53        } 
     54 
     55        void lisaaPisteLaskuri() 
     56        { 
    3157            // Luodaan pistelaskuri 
    3258            pisteLaskuri = new IntMeter(0); 
     
    3561            pisteNaytto = new ValueDisplay(); 
    3662            pisteNaytto.Text = "Pisteitä: "; 
    37             pisteNaytto.X = Screen.RightSafe - 250; 
    38             pisteNaytto.Y = Screen.TopSafe - 50; 
     63            pisteNaytto.X = Screen.RightSafe - 150; 
     64            pisteNaytto.Y = Screen.TopSafe - 20; 
    3965            pisteNaytto.BindTo(pisteLaskuri); 
    4066            Add(pisteNaytto);    // lisätään peliin 
    4167 
    42             // Zoomataan lähemmäksi 
    43             Camera.ZoomFactor = 2.0; 
    44  
    45             Camera.StayInLevel = true; 
    46  
    47             seuraavaKentta(); 
    48             MessageDisplay.Add("Etsi iso tähti!"); 
    49         } 
    50  
    51         void seuraavaKentta() 
    52         { 
    53             ClearAll(); 
    54             pisteLaskuri.Reset();            
    55  
    56             // Asetetaan painovoima 
    57             Gravity = new Vector(0, -1000); 
    58  
    59             luoKentta(); 
    60             kenttaNro++; 
    61             if (kenttaNro > 2) kenttaNro = 1; 
    62  
    63             lisaaNappaimet(); 
    64             Camera.Follow(pelaaja1); 
     68 
    6569        } 
    6670 
    6771        void luoKentta() 
    6872        { 
     73            Level.Width = 2000; 
     74            Level.Height = 1000; 
    6975            Level.CreateBorders(); 
    7076            Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
     
    121127 
    122128            AddCollisionHandler(pelaaja1, osuiKenttaOlioon); 
    123  
     129             
    124130            Add(pelaaja1); 
    125131        } 
     
    160166        { 
    161167            hahmo.Walk(nopeus); 
     168            pisteLaskuri.Value = (int)((pelaaja1.Y + (Level.Height / 2)) / ruudunKorkeus); 
    162169        } 
    163170 
     
    165172        { 
    166173            hahmo.Jump(voima); 
     174            pisteLaskuri.Value = (int)((pelaaja1.Y +(Level.Height/2)) / ruudunKorkeus); 
    167175        } 
    168176 
     
    173181                this.PlaySound("maali"); 
    174182                int edellisenKentanPisteet = pisteLaskuri.Value; 
    175                 kenttaNro = +1; 
     183                kenttaNro += 1; 
    176184 
    177185                seuraavaKentta(); 
     
    181189            if (otherObject.Tag.ToString() == "tuuppaaja") 
    182190            { 
    183                 MessageDisplay.Add("Tormattiin tuuppaajaan"); 
    184191                collidingObject.Hit(new Vector(0, -10000)); 
    185                 Explosion e = new Explosion(100); 
     192                Explosion e = new Explosion(1000); 
    186193                e.Position = otherObject.Position; 
    187194                Add(e); 
Note: See TracChangeset for help on using the changeset viewer.