Changeset 7018 for 2015/30


Ignore:
Timestamp:
2015-07-24 11:36:05 (8 years ago)
Author:
mivasata
Message:

Uusi kenttä lisätty, mutta vielä ei pääse uuteen kenttään.

Location:
2015/30/ValtteriT/Labyrintti
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/Labyrintti.cs

    r6998 r7018  
    99public class Labyrintti : PhysicsGame 
    1010{ 
    11     const double nopeus = 200; 
     11    const double nopeus = 30000; 
    1212    const double hyppyNopeus = 3000; 
    1313    const int RUUDUN_KOKO = 40; 
     
    1515    AssaultRifle pelaajan1Ase; 
    1616 
     17    Image PlasmaPanos = LoadImage("PlasmaParticle"); 
     18    //Image LaserBeam = LoadImage("LaserBeam"); 
    1719    Image tankinKuva = LoadImage("Tankki"); 
    1820 
    1921    PhysicsObject pelaaja1; 
    2022    PhysicsObject CannonBall; 
     23    IntMeter Elamat; 
     24 
     25    int kenttaNro; 
    2126     
    2227    SoundEffect RajahdysAani = LoadSoundEffect("RajahdysAani"); 
     
    2429    public override void Begin() 
    2530    { 
     31        ClearAll(); 
     32 
    2633        Gravity = new Vector(0, 0); 
    2734 
     
    3340        Camera.StayInLevel = false; 
    3441    } 
     42 
     43    void SeuraavaKentta() 
     44    { 
     45        ClearAll(); 
     46 
     47        if (kenttaNro == 1) LuoKentta("kentta1"); 
     48        else if (kenttaNro == 2) LuoKentta("kentta2"); 
     49        else if (kenttaNro == 3) LuoKentta("kentta3"); 
     50        else if (kenttaNro > 3) Exit(); 
     51 
     52        LisaaNappaimet(); 
     53 
     54    } 
     55 
     56    void LuoKentta(string kenttaTiedostonNimi) 
     57    { 
     58        TileMap ruudut = TileMap.FromLevelAsset(kenttaTiedostonNimi); 
     59        //tässä luodaan kenttä tekstitiedostosta 
     60    } 
     61 
     62    void TormasiMaaliin(PhysicsObject pelaaja, PhysicsObject maali) 
     63    { 
     64        //Kasvatetaan kenttänumeroa yhdellä ja siirrytään seuraavaan kenttään: 
     65        kenttaNro++; 
     66        SeuraavaKentta(); 
     67    } 
     68 
     69 
    3570 
    3671    void LuoKentta() 
     
    4176        kentta.SetTileMethod('N', LisaaPelaaja); 
    4277        kentta.SetTileMethod('4', LisaaMiina); 
     78        kentta.SetTileMethod('5', LisaaMaali); 
    4379        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    4480        Level.CreateBorders(); 
    4581        Level.Background.Color = Color.White; 
    4682    } 
     83 
     84    void LisaaMaali(Vector paikka, double leveys, double korkeus) 
     85    { 
     86        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     87    } 
     88 
     89         
    4790 
    4891    void LisaaTaso(Vector paikka, double leveys, double korkeus) 
     
    71114        Miina.Tag = "Miina"; 
    72115        Add (Miina); 
     116 
     117        AddCollisionHandler(Miina, "CannonBall", AmmuitMiinan); 
    73118    } 
    74119 
     
    78123        pelaaja1.Position = paikka; 
    79124        pelaaja1.Restitution = 0.5; 
    80         pelaaja1.Mass = 0.5; 
     125        pelaaja1.Mass = 2.5; 
     126        pelaaja1.KineticFriction = 1; 
     127        pelaaja1.LinearDamping = 0.1; 
    81128        pelaaja1.Image = tankinKuva; 
    82129        pelaaja1.Tag = "tankki"; 
     
    85132        Add(pelaaja1); 
    86133 
     134        Elamat = new IntMeter(3, 0, 3); 
     135        Elamat.LowerLimit += delegate { pelaaja1.Destroy(); }; 
     136        ProgressBar elamaPalkki = new ProgressBar(150, 20); 
     137        elamaPalkki.X = Screen.Left + 150; 
     138        elamaPalkki.Y = Screen.Top - 20; 
     139        elamaPalkki.BindTo(Elamat); 
     140        Add(elamaPalkki); 
    87141         
    88142        pelaajan1Ase = new AssaultRifle(60, 10); 
    89143        pelaajan1Ase.IsVisible = false; 
    90         //pelaajan1Ase.CanHitOwner = true; 
    91         pelaajan1Ase.FireRate = 20.0; 
    92         pelaajan1Ase.Power.DefaultValue = 200; 
    93         pelaajan1Ase.ProjectileCollision = AmmusOsui; 
     144        pelaajan1Ase.CanHitOwner = false; 
     145        pelaajan1Ase.FireRate = 10; 
     146        pelaajan1Ase.Power.DefaultValue = 150; 
     147        //pelaajan1Ase.ProjectileCollision = AmmusOsui; 
     148        pelaajan1Ase.Ammo.Value = 25; 
    94149        pelaajan1Ase.X = 20.0; 
    95150        //pelaajan1Ase.ProjectileCollision = CollisionHandler.DestroyTarget; 
    96         pelaajan1Ase.ProjectileCollision = AmmuitMiinan; 
     151        //pelaajan1Ase.ProjectileCollision = AmmuitMiinan; 
    97152 
    98153        pelaaja1.Add(pelaajan1Ase); 
     
    109164        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
    110165        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    111  
    112         Mouse.ListenMovement(0.1, Tahtaa, "Tahtaa aseella"); 
     166        Keyboard.Listen(Key.Enter, ButtonState.Pressed, Begin, "Aloita alusta"); 
     167         
     168        Mouse.ListenMovement(0.0, Tahtaa, "Tahtaa aseella"); 
    113169        IsMouseVisible = true; 
    114170        Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 
     171        Keyboard.Listen(Key.Space, ButtonState.Down, Liiku, "Liikkuu", pelaaja1); 
    115172 
    116173        Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, new Vector (-nopeus, 0)); 
     
    119176        Keyboard.Listen(Key.Down, ButtonState.Down, Liikuta, "Liikkuu taaksepäin", pelaaja1, new Vector(0, -nopeus)); 
    120177        Keyboard.Listen(Key.Up, ButtonState.Up, Liikuta, "Ei liiku", pelaaja1, new Vector(0, 0)); 
    121  
     178         
    122179        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
    123  
     180         
    124181        ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, new Vector (-nopeus, 0)); 
    125182        ControllerOne.Listen(Button.X, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, new Vector (nopeus, 0)); 
     
    129186        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    130187    } 
     188    void Liiku(PhysicsObject hahmo) 
     189    { 
     190        hahmo.Push(Vector.FromLengthAndAngle(nopeus, hahmo.Angle)); 
     191    } 
     192 
    131193 
    132194    void Liikuta(PhysicsObject hahmo, Vector nopeus) 
     
    149211        rajahdys.Force = 65; 
    150212        Add(rajahdys); 
     213 
     214        Elamat.Value--; 
    151215    } 
    152216 
     
    175239        if(CannonBall != null) 
    176240        { 
    177         CannonBall.Size *= 2; 
    178             //ammus.Image = ? 
    179             CannonBall.MaximumLifetime = TimeSpan.FromSeconds(5.0); 
     241        CannonBall.Size *= 1.5; 
     242        CannonBall.Image = PlasmaPanos; 
     243            CannonBall.MaximumLifetime = TimeSpan.FromSeconds(2.5); 
    180244            CannonBall.Restitution = 1.0; 
     245            CannonBall.Tag = "CannonBall"; 
     246            CannonBall.IgnoresExplosions = false; 
     247            CannonBall.IgnoresPhysicsLogics = true; 
    181248        } 
    182249    } 
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/Labyrintti.csproj.Debug.cachefile

    r6998 r7018  
    11Content\maali.xnb 
    2 Content\RajahdysAani.xnb 
    32Content\norsu.xnb 
    43Content\tahti.xnb 
     4Content\kentta1.xnb 
    55Content\Rajahde.xnb 
    66Content\Miina.xnb 
     7Content\RajahdysAani.xnb 
    78Content\Tankki.xnb 
    8 Content\kentta1.xnb 
     9Content\LaserBeam.xnb 
     10Content\PlasmaParticle.xnb 
     11Content\kentta2.xnb 
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/obj/x86/Debug/Labyrintti.csproj.FileListAbsolute.txt

    r6998 r7018  
    3131C:\MyTemp\ValtteriT\Labyrintti\Labyrintti\Labyrintti\obj\x86\Debug\Labyrintti.exe 
    3232C:\MyTemp\ValtteriT\Labyrintti\Labyrintti\Labyrintti\obj\x86\Debug\Labyrintti.pdb 
     33C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\LaserBeam.xnb 
     34C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\PlasmaParticle.xnb 
     35C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\kentta2.xnb 
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/obj/x86/Debug/cachefile-{15692C82-E01C-4162-86C3-61CF42C88FB4}-targetpath.txt

    r6998 r7018  
    11Content\maali.xnb 
    2 Content\RajahdysAani.xnb 
    32Content\norsu.xnb 
    43Content\tahti.xnb 
     4Content\kentta1.xnb 
    55Content\Rajahde.xnb 
    66Content\Miina.xnb 
     7Content\RajahdysAani.xnb 
    78Content\Tankki.xnb 
    8 Content\kentta1.xnb 
     9Content\LaserBeam.xnb 
     10Content\PlasmaParticle.xnb 
     11Content\kentta2.xnb 
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/LabyrinttiContent/LabyrinttiContent.contentproj

    r6993 r7018  
    9595    </Compile> 
    9696  </ItemGroup> 
     97  <ItemGroup> 
     98    <Compile Include="LaserBeam.png"> 
     99      <Name>LaserBeam</Name> 
     100      <Importer>TextureImporter</Importer> 
     101      <Processor>TextureProcessor</Processor> 
     102    </Compile> 
     103  </ItemGroup> 
     104  <ItemGroup> 
     105    <Compile Include="PlasmaParticle.png"> 
     106      <Name>PlasmaParticle</Name> 
     107      <Importer>TextureImporter</Importer> 
     108      <Processor>TextureProcessor</Processor> 
     109    </Compile> 
     110  </ItemGroup> 
     111  <ItemGroup> 
     112    <Compile Include="kentta2.txt"> 
     113      <Name>kentta2</Name> 
     114      <Importer>TextFileImporter</Importer> 
     115      <Processor>TextFileContentProcessor</Processor> 
     116    </Compile> 
     117  </ItemGroup> 
    97118  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    98119  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/LabyrinttiContent/kentta1.txt

    r6998 r7018  
    11333333333333333333333333333333333333333333333 
    2 3   3       3   3   3       3   3       3   3 
    3 3   3       3   3   3       3   3       3   3 
    4 3   3       3   3   3       3   3       3   3 
    5 3   3   3   3   3   3   3   3   3   3   3   3 
    6 3   3   3   3   3   3   33333   3   3   3   3 
    7 3   3   3   3   3   3   3   3   3   3   3   3 
    8 3   3   3   3   3   3   3   33333   3   3   3 
    9 3   3   3   3   3   3   3           3   3   3 
    10 3   3   3   3   3   3   3           3  3   3 
    11 3   3   3   3   3   3   3   33333   3   3   3 
    12 3   3   3       3   3   3   3   3   3   3   3 
    13 3   3   3       3   3   3   3   3   3   3   3 
    14 3       3       3   3   3   3   3   3   3   3 
    15 3       3   3   3   3   33333   3   3   3   3 
    16      3   3   3   3   3   3   3   3   3   3 
    17 3   33333   3   3   3   3   3   3   3   3   3 
    18 3   34443   3   3   3   3       3   3   3   3 
    19 3   3 4  4  3   3   3   3       3   3   3   3 
    20 3   3   4   3   3   3   3       3   3   3   3 
    21 3   3 4     3   3   3   3   3   3   3   3   3 
    22 3   34443   3   3       3   3   3   3   3   3 
    23 3   33333   3   3       3   3   3   3   3   3 
    24 3       3   3   3       3   3   3   3   3  3 
    25 3       3   3   3   3   3   3   3   3   3   3 
    26 3       3   3   3   3       3   3   3   3   3 
    27 3   3       3       3       3   3   3   3   3 
    28 3   3  4    3       3       3   3   3   3   3 
    29 3   3       3       3   3   3   3   3   3   3 
     23   3    4  3   3   3       3   3       3   3 
     33   3  4    3   3   3       3   3       3   3 
     43   3     4 3   3   3       3   3       3   3 
     53   3 4 3   3   3   3   3   3   3   3   3   3 
     63   3   34  3   3   3   33333   3   3       3 
     73   3   3   3   3   3   3   3   3   3 444   3 
     83   34443  43   3   3   3   33333   3       3 
     93   34443   3   3   3   3           3   3   3 
     103   3   3 4 3   3   3   3           3 4 3   3 
     113   3   3   34443   3   3   33333   3   3   3 
     123   3   3    4  3   3   3   3   3   3   3   3 
     133   34  3  4    3   3   3   3   3   34  3   3 
     143 4     3   4  43   3   3   3   3   3   3   3 
     153     4 3   3   3   344433333   3   3   3   3 
     164    3   3   3   3   3   3   3   3   3   3 
     173   33333  434443   3   3   3   3   3   33333 
     183   34443   3   3   3   3    4  33333   3   3 
     193   3 4  4  3   3   3   3 4     3   3   3   3 
     203   3   4   3   3  43   3     4 3       44  3 
     213 4 3 4     3   3   3   3  43   3       4   3 
     223   34443   3   3     4 3   3   3       4  43 
     233   33333   3   3  4    3   3  43   3   3   3 
     243       34443   3    4  344 3   3   33333 4 3 
     253       34443   3 4 3   3   34  3   3   3   3 
     263       3   3   3   3    4  3   3       34  3 
     273   3       3 4   4 3 4    43   4       3   3 
     283   3  4    3   4   3    4  3   4       3  43 
     293   3       3 4   4 3   3   3   4   3   3   3 
    30303   3333333333333333333333333333333333333   3 
    31313    44444444444444444444444444444444444    3 
    32 3    44444444444444444444444444444444444    3 
     323    44444444444444444444444444444444444 5  3 
    33333 N  44444444444444444444444444444444444    3 
    3434333333333333333333333333333333333333333333333 
  • 2015/30/ValtteriT/Labyrintti/Labyrintti/LabyrinttiContent/obj/x86/Debug/ContentPipeline.xml

    r6993 r7018  
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2015-07-23T11:00:09.3971539+03:00</Time> 
     38      <Time>2015-07-24T11:33:22.4736975+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    7373      <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\Tankki.xnb</Output> 
    7474      <Time>2015-07-23T14:32:28.4159388+03:00</Time> 
     75    </Item> 
     76    <Item> 
     77      <Source>LaserBeam.png</Source> 
     78      <Name>LaserBeam</Name> 
     79      <Importer>TextureImporter</Importer> 
     80      <Processor>TextureProcessor</Processor> 
     81      <Options>None</Options> 
     82      <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\LaserBeam.xnb</Output> 
     83      <Time>2015-07-24T09:55:06.1242082+03:00</Time> 
     84    </Item> 
     85    <Item> 
     86      <Source>PlasmaParticle.png</Source> 
     87      <Name>PlasmaParticle</Name> 
     88      <Importer>TextureImporter</Importer> 
     89      <Processor>TextureProcessor</Processor> 
     90      <Options>None</Options> 
     91      <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\PlasmaParticle.xnb</Output> 
     92      <Time>2015-07-24T09:59:55.7947279+03:00</Time> 
     93    </Item> 
     94    <Item> 
     95      <Source>kentta2.txt</Source> 
     96      <Name>kentta2</Name> 
     97      <Importer>TextFileImporter</Importer> 
     98      <Processor>TextFileContentProcessor</Processor> 
     99      <Options>None</Options> 
     100      <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\kentta2.xnb</Output> 
     101      <Time>2015-07-24T11:25:39.319988+03:00</Time> 
    75102    </Item> 
    76103    <BuildSuccessful>true</BuildSuccessful> 
Note: See TracChangeset for help on using the changeset viewer.