Ignore:
Timestamp:
2016-07-06 14:51:21 (3 years ago)
Author:
oslahtin
Message:

Lähes toimiva pohja, bossin lagiattack lopussa korjattava

Location:
2016/27/OskariL/Ikaros Project 1
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2016/27/OskariL/Ikaros Project 1/Ikaros Project 1/Ikaros Project 1Content/Ikaros Project 1Content.contentproj

    r7790 r7891  
    5959    </Compile> 
    6060  </ItemGroup> 
     61  <ItemGroup> 
     62    <Compile Include="vihu1.png"> 
     63      <Name>vihu1</Name> 
     64      <Importer>TextureImporter</Importer> 
     65      <Processor>TextureProcessor</Processor> 
     66    </Compile> 
     67  </ItemGroup> 
    6168  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6269  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/27/OskariL/Ikaros Project 1/Ikaros Project 1/Ikaros_Project_1/Ikaros_Project_1.cs

    r7867 r7891  
    1010{ 
    1111    Boolean AlkuvalikkoKayty = false; 
     12    Boolean isTimerRunning = false; 
    1213    Image ikaros = LoadImage("ikaros"); 
    1314    Image siipi = LoadImage("siipi"); 
    14     Image rajahdys = LoadImage("asdfghjkl"); 
     15    Image vihu1 = LoadImage("vihu1"); 
    1516    PhysicsObject pelaaja; 
    1617    PhysicsObject ammus; 
    1718    PhysicsObject pahis1; 
    1819    PhysicsObject pahis2; 
     20 
     21    Color pahisVari; 
     22    Color pahisVari2; 
     23    Color pahisVari3; 
     24    Color pahisVari4; 
    1925 
    2026    Vector nopeusYlos = new Vector(0, 400); 
     
    2632    ExplosionSystem rajahdys2 = new ExplosionSystem(LoadImage("rajahdys_kuva"), 200); 
    2733 
    28     int PahiksenElamat = 0; 
     34    DoubleMeter alaspainLaskuri; 
     35 
     36    int i = 0; 
     37    IntMeter PelaajanElamat; 
     38    IntMeter PahiksenElamat; 
    2939    int KenttaNro = 0; 
    3040    public override void Begin() 
     
    3747       LuoKentta(); 
    3848       AsetaNappaimet(); 
    39        // LisaaLaskurit(); 
     49       LuoAikaLaskuri(); 
    4050       // AloitaPeli(); 
    4151    } 
     
    8898        pelaaja.CanRotate = false; 
    8999        pelaaja.Mass = 5.0; 
     100        pelaaja.CollisionIgnoreGroup = 3; 
    90101        Add(pelaaja); 
     102 
     103        PelaajanElamat = new IntMeter(15); 
     104 
     105        Label pelaajanElama = new Label(); 
     106        pelaajanElama.Title = "Pelaajan elämät:"; 
     107        pelaajanElama.X = pelaaja.X + 600; 
     108        pelaajanElama.Y = pelaaja.Y; 
     109        pelaajanElama.TextColor = Color.Black; 
     110        pelaajanElama.Color = Color.Transparent; 
     111        pelaajanElama.BindTo(PelaajanElamat); 
     112        Add(pelaajanElama); 
     113 
    91114    } 
    92115    void LuoPahis1() 
     
    94117        pahis1 = new PhysicsObject(128.0, 128.0); 
    95118        pahis1.X = -300.0; 
    96         pahis1.Y = Level.Bottom + 800.0; 
    97         pahis1.Shape = Shape.Rectangle; 
    98         pahis1.Color = Color.Aquamarine; 
    99         pahis1.Mass = 400.0; 
     119        pahis1.Y = Level.Top - 100.0; 
     120        pahis1.Shape = Shape.Circle; 
     121        pahis1.Image = vihu1; 
     122        pahis1.Mass = 4000.0; 
    100123        pahis1.Tag = "pahis"; 
     124        pahis1.CollisionIgnoreGroup = 2; 
    101125        pahis1.IgnoresExplosions = true; 
    102126        pahis1.IgnoresCollisionResponse = false; 
    103127        Add(pahis1); 
    104128 
    105         RandomMoverBrain satunnaisAivot = new RandomMoverBrain(100); 
    106         satunnaisAivot.ChangeMovementSeconds = 1; 
    107         pahis1.Brain = satunnaisAivot; 
     129        PahiksenElamat = new IntMeter(300); 
     130 
     131        Label PahiksenElama = new Label(); 
     132        PahiksenElama.Title = "Pahiksen elämät:"; 
     133        PahiksenElama.X = pelaaja.X + 600; 
     134        PahiksenElama.Y = pelaaja.Y + 30; 
     135        PahiksenElama.TextColor = Color.Black; 
     136        PahiksenElama.Color = Color.Transparent; 
     137        PahiksenElama.BindTo(PahiksenElamat); 
     138        Add(PahiksenElama); 
     139 
    108140    } 
    109141    void LuoPahis2() 
     
    111143        pahis2 = new PhysicsObject(128.0, 128.0); 
    112144        pahis2.X = -300.0; 
    113         pahis2.Y = Level.Bottom + 800.0; 
     145        pahis2.Y = Level.Top - 100.0; 
    114146        pahis2.Shape = Shape.Rectangle; 
    115147        pahis2.Color = Color.Azure; 
    116148        pahis2.Mass = 400.0; 
    117149        pahis2.Tag = "pahis"; 
     150        pahis1.CollisionIgnoreGroup = 2; 
    118151        pahis2.IgnoresExplosions = true; 
    119152        pahis2.IgnoresCollisionResponse = false; 
     
    163196        Keyboard.Listen(Key.Right, ButtonState.Released, AsetaNopeus, null, pelaaja, Vector.Zero); 
    164197        Keyboard.Listen(Key.Z, ButtonState.Down, AmmuPalloa1, "Ammu"); 
    165         Keyboard.Listen(Key.Z, ButtonState.Down, PahisAmpuu, "Ammu"); 
    166198        Keyboard.Listen(Key.X, ButtonState.Pressed, Pommi, "Pommi"); 
    167199 
     
    172204    void Pommi() 
    173205    { 
    174         ammus.Destroy(); 
    175  
     206            ammus.Destroy(); 
    176207    } 
    177208    void PahisAmpuu() 
    178209    { 
    179         LuoAmmus(pahis1.X, pahis1.Y - 100, Shape.Triangle, Color.DarkCyan, 1); 
     210        LuoAmmus(pahis1.X, pahis1.Y - 100, Shape.Triangle, Color.DarkCyan, 2); 
    180211        ammus.Hit(RandomGen.NextVector(-100.0, 100.0)); 
    181212    } 
    182213    void AmmuPalloa1() 
    183214    { 
    184         LuoAmmus(pelaaja.X, pelaaja.Y + 24, Shape.Circle, Color.LightCyan, 1); 
     215        LuoAmmus(pelaaja.X, pelaaja.Y + 24, Shape.Circle, Color.LightCyan, 3); 
    185216        ammus.Hit(new Vector(RandomGen.SelectOne(0, 200, -200, 90, -150, 42), RandomGen.SelectOne(0, 800, -600, 200, -200, 120, -1200))); 
    186217 
     
    188219    void LuoAmmus(double x, double y, Shape shape, Color vari, int cig) 
    189220    { 
    190         ammus = new PhysicsObject(32.0, 32.0); 
    191         ammus.X = x; 
    192         ammus.Y = y; 
    193         ammus.Shape = shape; 
    194         ammus.Color = vari; 
    195         ammus.CanRotate = true; 
    196         ammus.IgnoresCollisionResponse = false; 
    197         ammus.CollisionIgnoreGroup = cig; 
    198         ammus.Tag = "ammus"; 
    199         Add(ammus); 
    200         AddCollisionHandler(ammus, "seina", CollisionHandler.DestroyObject); 
    201         //AddCollisionHandler(ammus, "pahis", CollisionHandler.ExplodeObject(50, true)); 
    202         AddCollisionHandler(ammus, "pahis", PahistaAmmutaan); 
    203         AddCollisionHandler(ammus, "pelaaja", PelaajaaAmmutaan); 
    204  
     221        if (i < 10) 
     222        { 
     223            ammus = new PhysicsObject(32.0, 32.0); 
     224            ammus.X = x; 
     225            ammus.Y = y; 
     226            ammus.Shape = shape; 
     227            ammus.Color = vari; 
     228            ammus.CanRotate = true; 
     229            ammus.IgnoresCollisionResponse = false; 
     230            ammus.IgnoresExplosions = true; 
     231            ammus.CollisionIgnoreGroup = cig; 
     232            ammus.IgnoresCollisionWith(ammus); 
     233            ammus.Tag = "ammus"; 
     234            Add(ammus); 
     235            AddCollisionHandler(ammus, "seina", CollisionHandler.DestroyObject); 
     236            //AddCollisionHandler(ammus, "ammus", CollisionHandler.ExplodeObject(1, true)); 
     237            AddCollisionHandler(ammus, pahis1, PahistaAmmutaan); 
     238            AddCollisionHandler(ammus, pelaaja, PelaajaaAmmutaan); 
     239        } 
     240        else if (i > 10) 
     241        { 
     242            LuoAikaLaskuri(); 
     243        } 
    205244    } 
    206245    void PelaajaaAmmutaan(PhysicsObject ammus, PhysicsObject pelaaja) 
    207246    { 
    208         pelaaja.Destroy(); 
     247 
     248        if (PelaajanElamat > 0) 
     249        { 
     250            PelaajanElamat.Value -= 1; 
     251            if (PelaajanElamat == 0) 
     252            { 
     253                pelaaja.Destroy(); 
     254                KenttaNro = 0; 
     255                AlkuvalikkoKayty = false; 
     256                Begin(); 
     257            } 
     258        } 
    209259    } 
    210260    void PahistaAmmutaan(PhysicsObject ammus, PhysicsObject pahis) 
    211261    { 
    212         if (PahiksenElamat == 50) 
    213         { 
    214             PahiksenElamat = new int(); 
    215         } 
    216         PahiksenElamat--; 
     262        if (PahiksenElamat > 0) 
     263        { 
     264            PahiksenElamat.Value -= 1; 
     265        } 
    217266        if (PahiksenElamat == 0) 
    218267        { 
     
    222271        } 
    223272    } 
     273    void LuoAikaLaskuri() 
     274    { 
     275        if (isTimerRunning == true) 
     276        { 
     277            return; 
     278        } 
     279        alaspainLaskuri = new DoubleMeter(1); 
     280 
     281        Timer aikaLaskuri = new Timer(); 
     282        aikaLaskuri.Interval = 1.3; 
     283        aikaLaskuri.Timeout += AikaLoppui; 
     284        aikaLaskuri.Start(); 
     285        isTimerRunning = true; 
     286    } 
     287    void AikaLoppui() 
     288    { 
     289        pahisVari = RandomGen.NextColor(); 
     290        pahisVari2 = RandomGen.NextColor(); 
     291        pahisVari3 = RandomGen.NextColor(); 
     292        pahisVari4 = RandomGen.NextColor(); 
     293        alaspainLaskuri.Value -= 1.3; 
     294        if (alaspainLaskuri.Value <= 0) 
     295        { 
     296            alaspainLaskuri.Stop(); 
     297            isTimerRunning = false; 
     298            while (i < 20) 
     299            { 
     300                LuoAmmus(pahis1.X, pahis1.Y - 100, Shape.Circle, pahisVari, 2); 
     301                ammus.Hit(RandomGen.NextVector(-300.0, 100.0)); 
     302                LuoAmmus(pahis1.X, pahis1.Y + 100, Shape.Rectangle, pahisVari2, 2); 
     303                ammus.Hit(RandomGen.NextVector(-300.0, 100.0)); 
     304                LuoAmmus(pahis1.X + 100, pahis1.Y, Shape.Triangle, pahisVari3, 2); 
     305                ammus.Hit(RandomGen.NextVector(-300.0, 300.0)); 
     306                LuoAmmus(pahis1.X - 100, pahis1.Y, Shape.Star, pahisVari4, 2); 
     307                ammus.Hit(RandomGen.NextVector(-300.0, 300.0)); 
     308                i++; 
     309            } 
     310            i = 0; 
     311        } 
     312    } 
     313 
    224314} 
  • 2016/27/OskariL/Ikaros Project 1/Ikaros Project 1/Ikaros_Project_1/Ikaros_Project_1.csproj.Debug.cachefile

    r7790 r7891  
    11Content\ikaros.xnb 
    22Content\siipi.xnb 
     3Content\vihu1.xnb 
  • 2016/27/OskariL/Ikaros Project 1/Ikaros Project 1/Ikaros_Project_1/obj/x86/Debug/ContentPipeline-{7420C726-1CE8-4AAD-880B-4E5D6E4E44DB}.xml

    r7790 r7891  
    1919      <Output>C:\MyTemp\OskariL\Ikaros Project 1\Ikaros Project 1\Ikaros_Project_1\bin\x86\Debug\Content\siipi.xnb</Output> 
    2020      <Time>2016-07-05T14:21:16.2649561+03:00</Time> 
     21    </Item> 
     22    <Item> 
     23      <Source>vihu1.png</Source> 
     24      <Name>vihu1</Name> 
     25      <Importer>TextureImporter</Importer> 
     26      <Processor>TextureProcessor</Processor> 
     27      <Options>None</Options> 
     28      <Output>C:\MyTemp\OskariL\Ikaros Project 1\Ikaros Project 1\Ikaros_Project_1\bin\x86\Debug\Content\vihu1.xnb</Output> 
     29      <Time>2016-07-06T14:37:01.1811846+03:00</Time> 
    2130    </Item> 
    2231    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/27/OskariL/Ikaros Project 1/Ikaros Project 1/Ikaros_Project_1/obj/x86/Debug/Ikaros_Project_1.csproj.FileListAbsolute.txt

    r7790 r7891  
    99C:\MyTemp\OskariL\Ikaros Project 1\Ikaros Project 1\Ikaros_Project_1\bin\x86\Debug\Content\ikaros.xnb 
    1010C:\MyTemp\OskariL\Ikaros Project 1\Ikaros Project 1\Ikaros_Project_1\bin\x86\Debug\Content\siipi.xnb 
     11C:\MyTemp\OskariL\Ikaros Project 1\Ikaros Project 1\Ikaros_Project_1\bin\x86\Debug\Content\vihu1.xnb 
  • 2016/27/OskariL/Ikaros Project 1/Ikaros Project 1/Ikaros_Project_1/obj/x86/Debug/cachefile-{7420C726-1CE8-4AAD-880B-4E5D6E4E44DB}-targetpath.txt

    r7790 r7891  
    11Content\ikaros.xnb 
    22Content\siipi.xnb 
     3Content\vihu1.xnb 
Note: See TracChangeset for help on using the changeset viewer.