Changeset 1158


Ignore:
Timestamp:
2010-07-07 15:02:52 (13 years ago)
Author:
arhetaka
Message:

edistyy vähän.

Location:
2010/24/arhetaka/AcesHigh/AcesHigh
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2010/24/arhetaka/AcesHigh/AcesHigh/Content/Content.contentproj

    r1097 r1158  
    101101    </Compile> 
    102102  </ItemGroup> 
     103  <ItemGroup> 
     104    <Compile Include="vih_aija.png"> 
     105      <Name>vih_aija</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108    </Compile> 
     109  </ItemGroup> 
     110  <ItemGroup> 
     111    <Compile Include="vih_tankki.png"> 
     112      <Name>vih_tankki</Name> 
     113      <Importer>TextureImporter</Importer> 
     114      <Processor>TextureProcessor</Processor> 
     115    </Compile> 
     116  </ItemGroup> 
    103117</Project> 
  • 2010/24/arhetaka/AcesHigh/AcesHigh/Peli.cs

    r1097 r1158  
    3030        Level.Height = Screen.Height; 
    3131        Level.Width = 20000; 
    32         Level.CreateBorders(); 
    33         //Camera.ZoomToLevel(); 
    34         //Level.CreateBottomBorder(); 
    35         PhysicsObject maa = new PhysicsObject(Level.Width, 50); 
     32        Level.CreateBorders();         
     33        Level.CreateBottomBorder(); 
     34        Level.Background.CreateGradient(Color.White, Color.Blue); 
     35        Level.CreateGround(100, 200, 50, Color.Green); 
     36        /* 
     37        PhysicsObject maa = PhysicsObject.CreateStaticObject(Level.Width, 50); 
    3638        //maa.CollisionIgnorer. 
    3739        maa.Color = Color.Green; 
    3840        maa.Tag = "maailma"; 
    39         maa.Y = Level.Bottom; 
    40          
    41         Add(maa); 
     41        maa.Y = Level.Bottom;         
     42        Add(maa);*/ 
     43 
    4244        kone1 = TeeLentokone(true); 
    4345        kone1.Image = LoadImage("kone1"); 
     
    4749        //Camera.FollowedObject = kone1.; 
    4850         
    49  
     51        /* 
    5052        kone2 = TeeLentokone(true); 
    5153        kone2.Image = LoadImage("kone2"); 
     
    5456        kone2.X = 100; 
    5557        Add(kone2); 
    56  
     58        */ 
    5759        Image[] kone1_kaantyy_kuvat = LoadImages("kone1_nurin", "kone1_nurin_2", "kone1_nurin_3", "kone1_nurin_4", "kone1"); 
    5860        kone1_kaantyy_animation = new Animation(kone1_kaantyy_kuvat); 
     
    6365 
    6466        TeeOhjaimet(); 
     67 
     68        Camera.StayInLevel = true; 
     69 
    6570 
    6671        systeemi = new ExplosionSystem(LoadImage("rajahdys"), 100, false); 
     
    7176        Add(systeemi); 
    7277 
     78        for (int a = 0; a < 100; a++) 
     79        { 
     80            LuoVihollinen(RandomGen.NextInt(2)); 
     81        } 
     82 
    7383    } 
    7484    PhysicsObject TeeLentokone(bool ihminen) 
     
    8393    void TeeOhjaimet() 
    8494    { 
     95        //pelaaja 1 
    8596        Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, kone1); 
    86         Keyboard.Listen(Key.Right, ButtonState.Down, KaannaPelaajaa, null, kone1, -1); 
    87         Keyboard.Listen(Key.Left, ButtonState.Down, KaannaPelaajaa, null, kone1, 1); 
     97        Keyboard.Listen(Key.Right, ButtonState.Down, KaannaPelaajaa, null, kone1, -2); 
     98        Keyboard.Listen(Key.Left, ButtonState.Down, KaannaPelaajaa, null, kone1, 2); 
    8899        Keyboard.Listen(Key.Right, ButtonState.Up, KaannaPelaajaa, null, kone1, 0); 
    89100        Keyboard.Listen(Key.Left, ButtonState.Up, KaannaPelaajaa, null, kone1, 0); 
     
    91102        Keyboard.Listen(Key.RightControl, ButtonState.Pressed, Ammu, null, kone1, 1); 
    92103 
     104        //pelaaja 2 
     105        /* 
    93106        Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, kone2); 
    94107        Keyboard.Listen(Key.D, ButtonState.Down, KaannaPelaajaa, null, kone2, -1); 
     
    97110        Keyboard.Listen(Key.A, ButtonState.Up, KaannaPelaajaa, null, kone2, 0); 
    98111        Keyboard.Listen(Key.S, ButtonState.Pressed, PyoritaPelaajaa, null, kone2); 
    99         Keyboard.Listen(Key.LeftControl, ButtonState.Pressed, Ammu, null, kone2, 1); 
     112        Keyboard.Listen(Key.LeftControl, ButtonState.Pressed, Ammu, null, kone2, 1);*/ 
    100113    } 
    101114 
     
    197210    void AmmusOsuu(PhysicsObject ammus, PhysicsObject kohde) 
    198211    { 
     212         
    199213        if (kohde.Tag != "") 
    200214        { 
    201215            string ampuja = ammus.Tag.ToString(); 
    202216            string uhri = kohde.Tag.ToString(); 
    203  
    204  
    205             if (ampuja[4] != uhri[4] && kohde.Tag != "ajopiste") 
    206             { 
    207                 systeemi.AddEffect(ammus.X, ammus.Y, 5);                 
    208                 ammus.Destroy(); 
    209             } 
     217            if (uhri == "viho_aija" || uhri == "viho_tankki") 
     218            { 
     219                 
     220                kohde.MaximumLifetime = TimeSpan.FromMilliseconds(2000)  + kohde.Lifetime; 
     221                //Remove(kohde); 
     222            } 
     223            else 
     224            { 
     225                if (ampuja[4] != uhri[4] && kohde.Tag != "ajopiste") 
     226                { 
     227                    systeemi.AddEffect(ammus.X, ammus.Y, 5); 
     228                    ammus.Destroy(); 
     229                } 
     230            } 
     231        } 
     232        if (kohde.Tag != "kone1") 
     233        { 
     234            systeemi.AddEffect(ammus.X, ammus.Y, 5); 
     235            ammus.Destroy(); 
    210236        } 
    211237    } 
     
    214240    { 
    215241        PaivitaKoneenNoste(kone1); 
    216         PaivitaKoneenNoste(kone2); 
     242        //PaivitaKoneenNoste(kone2); 
    217243        Camera.X = kone1.X; 
    218244        base.Update(time); 
    219245    } 
     246    void LuoVihollinen(int tyyppi) 
     247    { 
     248        PhysicsObject vihollinen = new PhysicsObject(30, 30); 
     249        vihollinen.Shape = Shapes.Triangle; 
     250        vihollinen.KineticFriction = 1; 
     251        vihollinen.Mass = 1; 
     252        vihollinen.X = RandomGen.NextDouble(Level.Left + 20, Level.Right -20); 
     253        vihollinen.Y = Level.Bottom + 200; 
     254        vihollinen.AngularDamping = 1; 
     255        if (tyyppi == 1) 
     256        { 
     257            vihollinen.Image = LoadImage("vih_aija"); 
     258            vihollinen.Tag = "viho_aija"; 
     259        } 
     260        else 
     261        { 
     262            vihollinen.Image = LoadImage("vih_tankki"); 
     263            vihollinen.Tag = "viho_tankki"; 
     264        } 
     265         
     266        Add(vihollinen); 
     267    } 
     268 
    220269} 
Note: See TracChangeset for help on using the changeset viewer.