Changeset 7894 for 2016


Ignore:
Timestamp:
2016-07-06 14:53:53 (3 years ago)
Author:
pepihlaj
Message:
 
Location:
2016/27/PekkaP
Files:
3 added
13 edited

Legend:

Unmodified
Added
Removed
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroops/FinnishTroops.cs

    r7881 r7894  
    2020    IntMeter pelaajan1Pisteet; 
    2121    Image ammus = LoadImage("Ammus2"); 
     22    Image Palikka = LoadImage("Palikka"); 
     23    IntMeter PelaajanElamat; 
    2224    public override void Begin() 
    2325    { 
     
    2527 
    2628        LuoKentta(); 
    27         LuoPisteLaskuri(Screen.Left +20.0, Screen.Top -20.0); 
     29        LuoPisteLaskuri(Screen.Left + 20.0, Screen.Top - 20.0); 
    2830        LisaaNappaimet(); 
    2931 
     
    4850    void LisaaPahis(Vector paikka, double leveys, double korkeus) 
    4951    { 
    50         Vihu pahis = new Vihu (leveys*0.8, korkeus*0.9); 
     52        Vihu pahis = new Vihu(leveys * 0.8, korkeus * 0.9); 
     53        pahis.X = -100; 
     54        pahis.Y = -100; 
     55        // ... 
     56        pahis.ElamaLaskuri.Value--; 
    5157        pahis.Image = pahisKuva; 
    5258        pahis.Position = paikka; 
    5359        Add(pahis); 
    5460        pahis.Tag = "PahisSotilas"; 
    55          
     61 
    5662        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
    5763        tasoAivot.JumpSpeed = 700; 
     
    6167        pahis.Brain = tasoAivot; 
    6268 
     69        pahis.Weapon = new AssaultRifle(30, 10); 
     70        pahis.Weapon.ProjectileCollision = AmmusOsui; 
     71        Timer ajastin = new Timer(); 
     72        ajastin.Interval = 1.5; 
     73        ajastin.Timeout += delegate { PahisAmmuAseella(pahis); }; 
     74            ajastin.Start(); 
     75 
     76 
    6377    } 
    6478 
     
    6781        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    6882        taso.Position = paikka; 
    69         taso.Color = Color.Charcoal; 
     83        taso.Image = Palikka; 
    7084        Add(taso); 
    7185    } 
     
    8397    void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
    8498    { 
    85         pelaaja1 = new PlatformCharacter(leveys*0.6, korkeus*0.9); 
     99        pelaaja1 = new PlatformCharacter(leveys * 0.6, korkeus * 0.9); 
    86100        pelaaja1.Position = paikka; 
    87101        pelaaja1.Mass = 4.0; 
     
    102116        Grenade kranaatti = new Grenade(4.0); 
    103117 
    104  
    105  
    106  
    107  
     118        PelaajanElamat = new IntMeter(5); 
     119 
     120        Label pelaajanElama = new Label(); 
     121        pelaajanElama.X = pelaaja1.X + 600; 
     122        pelaajanElama.Y = pelaaja1.Y + 600; 
     123        pelaajanElama.TextColor = Color.LightPink; 
     124        pelaajanElama.Color = Color.Transparent; 
     125        pelaajanElama.BindTo(PelaajanElamat); 
     126        Add(pelaajanElama); 
    108127 
    109128    } 
     
    117136    void KranaattiOsui(IPhysicsObject rajahdyksenKohde, Vector v) 
    118137    { 
    119         if(rajahdyksenKohde.Tag.Equals("PahisSotilas") || rajahdyksenKohde.Tag.Equals("pelaaja1")) rajahdyksenKohde.Destroy(); 
     138        if (rajahdyksenKohde.Tag.Equals("PahisSotilas") || rajahdyksenKohde.Tag.Equals("pelaaja1")) rajahdyksenKohde.Destroy(); 
    120139    } 
    121140 
     
    159178 
    160179    } 
    161     
     180 
    162181 
    163182    IntMeter LuoPisteLaskuri(double x, double y) 
     
    180199    void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 
    181200    { 
     201        if (kohde == pelaaja1) 
     202        { 
     203            if (PelaajanElamat > 0) 
     204            { 
     205                PelaajanElamat.Value -= 1; 
     206                if (PelaajanElamat == 0) 
     207                { 
     208                    pelaaja1.Destroy(); 
     209                } 
     210            } 
     211 
     212        } 
     213        if (kohde == pelaaja1) 
     214        { 
     215            if (PelaajanElamat > 0) 
     216            { 
     217                PelaajanElamat.Value -= 1; 
     218                if (PelaajanElamat == 0) 
     219                { 
     220                    pelaaja1.Destroy(); 
     221                } 
     222            } 
     223 
     224        } 
     225 
     226 
    182227        ammus.Destroy(); 
    183228    } 
     229    void PahisAmmuAseella(PlatformCharacter pahis) 
     230    { 
     231        PhysicsObject ammus = pahis.Weapon.Shoot(); 
     232        if (ammus != null) 
     233        { 
     234            ammus.Size *= 1.0; 
     235            ammus.Image = LoadImage("Ammus2"); 
     236            ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
     237 
     238        } 
     239 
     240    } 
    184241    void AmmuAseella(PlatformCharacter pelaaja) 
    185 { 
    186     PhysicsObject ammus = pelaaja.Weapon.Shoot(); 
    187  
    188     if(ammus != null) 
    189     { 
    190         ammus.Size *= 1.0; 
     242    { 
     243        PhysicsObject ammus = pelaaja.Weapon.Shoot(); 
     244        if (ammus != null) 
     245        { 
     246            ammus.Size *= 1.0; 
    191247            ammus.Image = LoadImage("Ammus2"); 
    192         ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
    193           
     248            ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
     249 
    194250        } 
    195251     
    196 } 
     252    } 
     253     
    197254} 
    198255 
     
    209266    } 
    210267} 
    211  
    212 class PeliHahmo : PhysicsObject 
    213 { 
    214     public int Elamat { get; set; } 
    215     public bool OnHidas { get; set; } 
    216     public int KenganNumero { get; set; } 
    217     public int Rahat { get; set; } 
    218     public Vector RespausKoordinaatit { get; set; } 
    219  
    220     public PeliHahmo(double leveys, double korkeus) 
    221         : base(leveys, korkeus) 
    222     { 
    223         Elamat = 3; 
    224         OnHidas = false; 
    225         KenganNumero = 42; 
    226         Rahat = 1000; 
    227         RespausKoordinaatit = Vector.Zero; 
    228     } 
    229 } 
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroops/FinnishTroops.csproj.Debug.cachefile

    r7865 r7894  
    88Content\Sotilas1Vihollinen.xnb 
    99Content\Ammus2.xnb 
     10Content\Palikka.xnb 
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroops/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r7881 r7894  
    4545      <Options>None</Options> 
    4646      <Output>C:\MyTemp\PekkaP\FinnishTroops\FinnishTroops\FinnishTroops\bin\x86\Debug\Content\kentta1.xnb</Output> 
    47       <Time>2016-07-06T13:11:34.6251453+03:00</Time> 
     47      <Time>2016-07-06T14:49:02.3470913+03:00</Time> 
    4848    </Item> 
    4949    <Item> 
     
    8282      <Output>C:\MyTemp\PekkaP\FinnishTroops\FinnishTroops\FinnishTroops\bin\x86\Debug\Content\Ammus2.xnb</Output> 
    8383      <Time>2016-07-06T10:55:11.0448985+03:00</Time> 
     84    </Item> 
     85    <Item> 
     86      <Source>Palikka.png</Source> 
     87      <Name>Palikka</Name> 
     88      <Importer>TextureImporter</Importer> 
     89      <Processor>TextureProcessor</Processor> 
     90      <Options>None</Options> 
     91      <Output>C:\MyTemp\PekkaP\FinnishTroops\FinnishTroops\FinnishTroops\bin\x86\Debug\Content\Palikka.xnb</Output> 
     92      <Time>2016-07-06T13:27:54.3210646+03:00</Time> 
    8493    </Item> 
    8594    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroops/obj/x86/Debug/FinnishTroops.csproj.FileListAbsolute.txt

    r7865 r7894  
    1616C:\MyTemp\PekkaP\FinnishTroops\FinnishTroops\FinnishTroops\bin\x86\Debug\Content\Sotilas1Vihollinen.xnb 
    1717C:\MyTemp\PekkaP\FinnishTroops\FinnishTroops\FinnishTroops\bin\x86\Debug\Content\Ammus2.xnb 
     18C:\MyTemp\PekkaP\FinnishTroops\FinnishTroops\FinnishTroops\bin\x86\Debug\Content\Palikka.xnb 
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroops/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r7865 r7894  
    88Content\Sotilas1Vihollinen.xnb 
    99Content\Ammus2.xnb 
     10Content\Palikka.xnb 
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroopsContent/FinnishTroopsContent.contentproj

    r7865 r7894  
    102102    </Compile> 
    103103  </ItemGroup> 
     104  <ItemGroup> 
     105    <Compile Include="Palikka.png"> 
     106      <Name>Palikka</Name> 
     107      <Importer>TextureImporter</Importer> 
     108      <Processor>TextureProcessor</Processor> 
     109    </Compile> 
     110  </ItemGroup> 
    104111  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    105112  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/27/PekkaP/FinnishTroops/FinnishTroops/FinnishTroopsContent/kentta1.txt

    r7881 r7894  
    1    #............................................# 
    2    #*........*.......*..*........*.....*.......*# 
    3    ###....#####....########....############....## 
    4    #...............*............................# 
    5    #......#........#........*...........*....*..# 
    6    ########...#######....#########.....########## 
    7    #..........*.....*...........................# 
    8    #..........#.....#....#.............#........# 
    9    ###.........*...###...##.*..##....###.*..###.# 
    10    #.....*.....#...*........#....*.......#......# 
    11    #.N...#.....#...#........#....#.......#MMMMMM# 
    12    ############################################## 
     1#.......................................................................# 
     2#.......................................................................# 
     3#.......................................................................# 
     4#.......................................................................# 
     5#.......................................................................# 
     6#.......................................................................# 
     7#.......................................................................# 
     8#.......................................................................# 
     9#.......................................................................# 
     10#.......................................................................# 
     11#.......................................................................# 
     12#..........................................#.M...M#..........M....M..M..# 
     13##########......############..............####...###.........############ 
     14#..............##.........M#...............#..M.#.#..........#..........# 
     15#.............##..........##...............#..#...#..........#MMMM......# 
     16#............##............................##.....#..........#####......# 
     17#.N.........##.....M...M................................................# 
     18######################################################################### 
Note: See TracChangeset for help on using the changeset viewer.