Changeset 8705 for 2017/24


Ignore:
Timestamp:
2017-06-15 11:58:04 (6 years ago)
Author:
npo17_22
Message:

pistegeneraattori toimiii kohta

Location:
2017/24/EljaL/TheMetsäsurvivor
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 2017/24/EljaL/TheMetsäsurvivor/TheMetsäsurvivor/TheMetsäsurvivor/TheMetsäsurvivor.cs

    r8673 r8705  
    88 
    99public class TheMetsäsurvivor : PhysicsGame 
    10 { PhysicsObject ihminen; 
     10{ 
     11    PhysicsObject ihminen; 
    1112    PhysicsObject karhu; 
    1213    public override void Begin() 
     
    1617 
    1718        Mouse.IsCursorVisible = true; 
    18  
    19         
    2019 
    2120        Camera.Zoom(1.0); 
     
    4443        Add(karhu); 
    4544 
    46         seuraajanAivot.Speed = 50; 
     45        seuraajanAivot.Speed = 100; 
    4746        seuraajanAivot.DistanceFar = 1000; 
    4847        seuraajanAivot.FarBrain = satunnaisAivot; 
     
    6968        luopojolaskuri(); 
    7069        luohplaskuri(); 
     70        luopistegen(); 
     71        LuoAikaLaskuri(); 
     72        luopuugen(); 
     73        luokivigen(); 
    7174 
    7275        luokentta(); 
     
    7780        Keyboard.Listen(Key.Down, ButtonState.Down, käännäpelaajaaa, null); 
    7881 
    79             Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-50, 0)); 
    80             Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(50, 0)); 
    81             Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 50)); 
    82             Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -50)); 
     82        Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-50, 0)); 
     83        Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(50, 0)); 
     84        Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 50)); 
     85        Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -50)); 
    8386 
    8487        Camera.Follow(ihminen); 
    8588    } 
    8689 
    87         void LiikutaPelaajaa(Vector vektori) 
    88 { 
    89             ihminen.Push(vektori); 
    90         } 
     90    void LiikutaPelaajaa(Vector vektori) 
     91    { 
     92        ihminen.Push(vektori); 
     93    } 
    9194    void luokentta() 
    9295    { 
    93         
     96 
    9497 
    9598        Level.Background.Color = Color.Wheat; 
     
    101104        ihminen.Angle = Angle.FromDegrees(-90); 
    102105    } 
    103 void käännäpelaajaao() 
     106    void käännäpelaajaao() 
    104107    { 
    105108        ihminen.Angle = Angle.FromDegrees(90); 
     
    123126        Add(kivi); 
    124127 
    125      
    126         
     128 
     129 
    127130 
    128131 
    129132        AddCollisionHandler(ihminen, kivi, kivitormays); 
    130          
     133 
    131134    } 
    132135    IntMeter puuLaskuri; 
     
    165168    { 
    166169        puuLaskuri.Value += 1; 
    167          
     170 
    168171    } 
    169172    void kivitormays(PhysicsObject tormaaja, PhysicsObject kivi) 
     
    176179    { 
    177180        pojolaskuri = new IntMeter(0); 
    178         pojolaskuri.AddOverTime(1000000000, 10000000000); 
    179181 
    180182        Label pojonaytto = new Label(); 
     
    185187        pojonaytto.Title = "pojot"; 
    186188 
     189 
    187190        pojonaytto.BindTo(pojolaskuri); 
    188191        Add(pojonaytto); 
     
    215218    { 
    216219        MessageDisplay.Add("kuolit"); 
    217     } 
    218      
     220        ihminen.Destroy(); 
     221    } 
     222 
    219223    void teepuu() 
    220224    { 
     
    237241 
    238242    } 
     243    IntMeter pistegen; 
     244 
     245    void luopistegen() 
     246    { 
     247        pistegen = new IntMeter(0); 
     248        pistegen.MaxValue = 10; 
     249        pistegen.MinValue = 0; 
     250 
     251 
     252        Label pistegennaytto = new Label(); 
     253        pistegennaytto.X = Screen.Right + -150; 
     254        pistegennaytto.Y = Screen.Top - 100; 
     255        pistegennaytto.TextColor = Color.Blue; 
     256        pistegennaytto.Color = Color.Wheat; 
     257        pistegennaytto.Title = "pistegeneraattorit"; 
     258        Keyboard.Listen(Key.I, ButtonState.Pressed, pistegeneraattori, null); 
     259 
     260        pistegennaytto.BindTo(pistegen); 
     261        Add(pistegennaytto); 
     262    } 
     263    void LuoAikaLaskuri() 
     264    { 
     265        Timer aikaLaskuri = new Timer(); 
     266        aikaLaskuri.Start(); 
     267 
     268        Label aikaNaytto = new Label(); 
     269        aikaNaytto.TextColor = Color.Black; 
     270        aikaNaytto.X = Screen.Left + 100; 
     271        aikaNaytto.Y = Screen.Top + -25; 
     272        aikaNaytto.Color = Color.Wheat; 
     273        aikaNaytto.DecimalPlaces = 0; 
     274        aikaNaytto.BindTo(aikaLaskuri.SecondCounter); 
     275        Add(aikaNaytto); 
     276    } 
     277    IntMeter puugen; 
     278 
     279    void luopuugen() 
     280    { 
     281        puugen = new IntMeter(0); 
     282 
     283        Label puugennaytto = new Label(); 
     284        puugennaytto.X = Screen.Right + -150; 
     285        puugennaytto.Y = Screen.Top - 75; 
     286        puugennaytto.TextColor = Color.Brown; 
     287        puugennaytto.Color = Color.Wheat; 
     288        puugennaytto.Title = "puugeneraattorit"; 
     289        Keyboard.Listen(Key.P, ButtonState.Pressed, puugeneraattori, null); 
     290 
     291        puugennaytto.BindTo(puugen); 
     292        Add(puugennaytto); 
     293    } 
     294    IntMeter kivigen; 
     295 
     296 
     297    void luokivigen() 
     298    { 
     299        kivigen = new IntMeter(0); 
     300 
     301        Label kivigennaytto = new Label(); 
     302        kivigennaytto.X = Screen.Right + -150; 
     303        kivigennaytto.Y = Screen.Top - 50; 
     304        kivigennaytto.TextColor = Color.Gray; 
     305        kivigennaytto.Color = Color.Wheat; 
     306        kivigennaytto.Title = "kivigeneraattorit"; 
     307        Keyboard.Listen(Key.K, ButtonState.Pressed, kivigenraattori, null); 
     308 
     309        kivigennaytto.BindTo(kivigen); 
     310        Add(kivigennaytto); 
     311    } 
     312    void kivigenraattori() 
     313    { 
     314        if (kivilaskuri > 9) 
     315        { 
     316            if (puuLaskuri > 29) 
     317            { 
     318                kivigen.Value += 1; 
     319                kivilaskuri.Value -= 10; 
     320                puuLaskuri.Value -= 30; 
     321            } 
     322        } 
     323 
     324 
     325 
     326 
     327 
     328    } 
     329    void puugeneraattori() 
     330    { 
     331        if (puuLaskuri > 9) 
     332        { 
     333            if (kivilaskuri > 29) 
     334            { 
     335                puugen.Value += 1; 
     336                puuLaskuri.Value -= 10; 
     337                kivilaskuri.Value -= 30; 
     338            } 
     339        } 
     340    } 
     341    void pistegeneraattori() 
     342    { 
     343        if (puuLaskuri > 0) 
     344        { 
     345            if (kivilaskuri > 0) 
     346            { 
     347                pistegen.Value += 1; 
     348                pojolaskuri.AddOverTime(1000000, 10000000); 
     349                puuLaskuri.Value -= 0; 
     350                kivilaskuri.Value -= 0; 
     351            } 
     352        } 
     353    } 
    239354} 
Note: See TracChangeset for help on using the changeset viewer.