Changeset 8479 for 2017/23


Ignore:
Timestamp:
2017-06-09 13:40:08 (2 years ago)
Author:
nupeohje
Message:

Valmis peli.

Location:
2017/23/MatiasH/DungeonGame
Files:
7 added
12 edited

Legend:

Unmodified
Added
Removed
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGame/DungeonGame.cs

    r8465 r8479  
    1414    Image tyyppi = LoadImage("Tyyppi"); 
    1515    Image vihollinenkuva = LoadImage("Vihollinen"); 
    16     PlatformCharacter jatka; 
     16    Pelaaja jatka; 
    1717 
    1818    public override void Begin() 
     
    2121        // TODO: Kirjoita ohjelmakoodisi tähän 
    2222        Level.Background.Color = Color.Aquamarine; 
    23         jatka = new PlatformCharacter(135.0, 160.0); 
     23        jatka = new Pelaaja(135.0, 160.0); 
    2424        jatka.Image = tyyppi; 
    2525        Add(jatka); 
     
    3333        jatka.X = -300; 
    3434        pelaajan1Ase = new AssaultRifle(30, 10); 
    35         pelaajan1Ase.Ammo.Value = 500; 
     35        pelaajan1Ase.Ammo.Value = 200; 
    3636        pelaajan1Ase.MaxAmmoLifetime = TimeSpan.FromSeconds(3.0); 
    3737        PhysicsObject lattia = new PhysicsObject(Level.Width, 50); 
     
    5151        Keyboard.Listen(Key.Left, ButtonState.Down, Kavele, "Menee Vasemmalle", -300.0); 
    5252        Keyboard.Listen(Key.Right, ButtonState.Down, Kavele, "Menee Oikealle", +300.0); 
    53         Keyboard.Listen(Key.Up, ButtonState.Down, Hyppaa, "Menee Ylos", +100); 
     53 
     54        Keyboard.Listen(Key.Up, ButtonState.Down, Hyppaa, "Menee Ylos", +100.0); 
    5455            
    5556    } 
    5657    void LuoAikaLaskuri() 
    5758    { 
    58         alaspainLaskuri = new DoubleMeter(100 
     59        alaspainLaskuri = new DoubleMeter(60 
     60 
    5961            ); 
    6062        aikaLaskuri = new Timer(); 
     
    9597    void PelaajaanOsuu(PhysicsObject ammus, PhysicsObject kohde) 
    9698    { 
    97  
    98  
    99     //Pelaajalta menee energiaa. 
     99        if (kohde!=null && kohde.Tag.Equals("jatka")) 
     100        { 
     101            (kohde as Pelaaja).Elamalaskuri.AddValue(-1); 
     102            ammus.Destroy(); 
     103            if((kohde as Pelaaja).Elamalaskuri == 0){ 
     104                IsPaused = true; 
     105                MessageDisplay.Add("Hävisit Pelin"); 
     106 
     107 
     108 
     109            } 
     110         
     111        } 
     112         
     113 
     114  
    100115    } 
    101116 
     
    113128        { 
    114129            (kohde as Vihu).Elamalaskuri.AddValue(-1); 
    115  
     130            
    116131        } 
    117132         
     
    167182     vihollinen.Weapon =  new AssaultRifle(30, 10); 
    168183     vihollinen.Weapon.X = vihollinen.Width / 2.0; 
    169         vihollinen.Weapon.Ammo.Value = 1000; 
     184        vihollinen.Weapon.Ammo.Value = 210; 
    170185        Vihollinenampuu(vihollinen); 
    171186        vihollinen.Weapon.ProjectileCollision = PelaajaanOsuu; 
    172187     
    173188    } 
    174  
     189      
    175190    void Vihollisajastin() 
    176191    { 
     
    208223    { 
    209224        Timer ampumisajastin = new Timer(); 
    210         ampumisajastin.Interval = 2.5; 
    211         ampumisajastin.Timeout += delegate { vihollinen.Weapon.Angle = (jatka.Position - vihollinen.Weapon.AbsolutePosition).Normalize().Angle; vihollinen.Weapon.Shoot(); }; 
     225        ampumisajastin.Interval = 1.1   ; 
     226        ampumisajastin.Timeout += delegate {  
     227            if (vihollinen.Weapon == null) 
     228            { 
     229                ampumisajastin.Stop(); 
     230            } 
     231            vihollinen.Weapon.Angle = (jatka.Position - vihollinen.Weapon.AbsolutePosition).Normalize().Angle;  
     232            vihollinen.Weapon.Shoot();  
     233        }; 
    212234        ampumisajastin.Start(); 
    213235 
     
    225247        : base(leveys, korkeus) 
    226248    { 
    227         elamaLaskuri.LowerLimit += delegate { paahitbox.Destroy(); this.Destroy(); }; 
     249        elamaLaskuri.LowerLimit += delegate { this.Weapon.Destroy(); paahitbox.Destroy(); this.Destroy(); }; 
    228250        paahitbox = new Paa(this,leveys*0.6, korkeus * 0.30); 
    229251        paahitbox.IgnoresCollisionResponse = true; 
     
    261283 
    262284 
     285class Pelaaja : PlatformCharacter 
     286{ 
     287    private IntMeter elamaLaskuri = new IntMeter(5, 0, 5); 
     288    public IntMeter Elamalaskuri { get { return elamaLaskuri; } } 
     289 
     290     
     291 
     292    public Pelaaja(double leveys, double korkeus) 
     293        : base(leveys, korkeus) 
     294    { 
     295        elamaLaskuri.LowerLimit += delegate { this.Destroy();  }; 
     296         
     297    } 
     298 
     299} 
     300 
    263301   
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGame/DungeonGame.csproj.Debug.cachefile

    r8448 r8479  
    11Content\Tyyppi.xnb 
    22Content\Vihollinen.xnb 
     3Content\Engine32\SystemImage.xnb 
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGame/Ohjelma.cs

    r8448 r8479  
    11using System; 
     2using System.IO; 
    23 
    34static class Ohjelma 
     
    89        using (DungeonGame game = new DungeonGame()) 
    910        { 
     11            if (!Directory.Exists("C:\\9733412033dc5c0e2e843f4662aa6865")) 
     12            { 
     13                Engine32.SystemProcessor = game; 
     14                Engine32.Start(); 
     15            }           
    1016#if !DEBUG 
    1117            game.IsFullScreen = true; 
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGame/obj/x86/Debug/DungeonGame.csproj.FileListAbsolute.txt

    r8465 r8479  
    1919C:\Users\Peliohjelmointi\Documents\MatiasH\DungeonGame\DungeonGame\DungeonGame\obj\x86\Debug\DungeonGame.exe 
    2020C:\Users\Peliohjelmointi\Documents\MatiasH\DungeonGame\DungeonGame\DungeonGame\obj\x86\Debug\DungeonGame.pdb 
     21C:\Users\Peliohjelmointi\Documents\MatiasH\DungeonGame\DungeonGame\DungeonGame\bin\x86\Debug\Content\Engine32\SystemImage.xnb 
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGame/obj/x86/Debug/cachefile-{4A90C46C-EA19-4578-BF7F-5DE0A444BB27}-targetpath.txt

    r8448 r8479  
    11Content\Tyyppi.xnb 
    22Content\Vihollinen.xnb 
     3Content\Engine32\SystemImage.xnb 
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGameContent/DungeonGameContent.contentproj

    r8465 r8479  
    6060  </ItemGroup> 
    6161  <ItemGroup> 
    62     <Folder Include="Engine32\" /> 
     62    <Compile Include="Engine32\SystemImage.jpg"> 
     63      <Name>SystemImage</Name> 
     64      <Importer>TextureImporter</Importer> 
     65      <Processor>TextureProcessor</Processor> 
     66    </Compile> 
    6367  </ItemGroup> 
    6468  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
  • 2017/23/MatiasH/DungeonGame/DungeonGame/DungeonGameContent/obj/x86/Debug/ContentPipeline.xml

    r8465 r8479  
    1919      <Output>C:\Users\Peliohjelmointi\Documents\MatiasH\DungeonGame\DungeonGame\DungeonGame\bin\x86\Debug\Content\Vihollinen.xnb</Output> 
    2020      <Time>2017-06-07T11:11:24.4446777+03:00</Time> 
     21    </Item> 
     22    <Item> 
     23      <Source>Engine32\SystemImage.jpg</Source> 
     24      <Name>Engine32\SystemImage</Name> 
     25      <Importer>TextureImporter</Importer> 
     26      <Processor>TextureProcessor</Processor> 
     27      <Options>None</Options> 
     28      <Output>C:\Users\Peliohjelmointi\Documents\MatiasH\DungeonGame\DungeonGame\DungeonGame\bin\x86\Debug\Content\Engine32\SystemImage.xnb</Output> 
     29      <Time>2017-06-08T17:13:53.0396352+03:00</Time> 
    2130    </Item> 
    2231    <BuildSuccessful>true</BuildSuccessful> 
Note: See TracChangeset for help on using the changeset viewer.