Changeset 1377 for 2010/27


Ignore:
Timestamp:
2010-07-28 14:55:04 (13 years ago)
Author:
aajokahe
Message:

Nurinam ninja pelistä puuttuu vaan loputtamasti tulvivat vihulaiset.

Location:
2010/27/Aajokahe
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/Aajokahe/Nurinams adventure/Content/Content.contentproj

    r1332 r1377  
    1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 
     1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 
    22  <PropertyGroup> 
    33    <ProjectGuid>910df4a7-3247-4e90-9ff5-9033645b4ebf</ProjectGuid> 
     
    3838      <Processor>SoundEffectProcessor</Processor> 
    3939    </Compile> 
     40    <Compile Include="Nurinam ninja.png"> 
     41      <Name>Nurinam ninja</Name> 
     42      <Importer>TextureImporter</Importer> 
     43      <Processor>TextureProcessor</Processor> 
     44    </Compile> 
     45    <Compile Include="Warrior.png"> 
     46      <Name>Warrior</Name> 
     47      <Importer>TextureImporter</Importer> 
     48      <Processor>TextureProcessor</Processor> 
     49    </Compile> 
    4050  </ItemGroup> 
    4151  <ItemGroup> 
  • 2010/27/Aajokahe/Nurinams adventure/Peli.cs

    r1359 r1377  
    99    const double nopeus = 200; 
    1010    const double hyppyVoima = 4000; 
     11    DoubleMeter voimaMittari; 
     12 
     13    IntMeter pisteLaskuri; 
     14    IntMeter pisteLaskuri2; 
    1115 
    1216    PlatformCharacter pelaaja1; 
     
    2226        lisaaNappaimet(); 
    2327        vihollinen=LuoVihollinen(); 
     28        LuoLaskuri(); 
     29        LuoHPBar(); 
    2430 
    2531        Camera.Follow(pelaaja1); 
    2632        Camera.ZoomFactor = 2.0; 
    2733        Camera.StayInLevel = true; 
     34        MessageDisplay.Add("sotalordin miehet ovat löytäneet sinun piilopaikkasi ja rynnivät sitä päin kiväärit tanassa. Sinun täytyy puolustaa piilopaikkaasi."); 
     35 
    2836    } 
    2937 
     
    4654        taso.Y = y; 
    4755        Add(taso); 
     56        taso.Tag = "talo"; 
     57 
    4858    } 
    4959 
     
    5262        pelaaja1 = new PlatformCharacter (40, 40); 
    5363        pelaaja1.Mass = 4.0; 
    54         pelaaja1.Image = LoadImage("Norsu"); 
     64        pelaaja1.Image = LoadImage("Nurinam ninja"); 
    5565        pelaaja1.X = -400; 
    5666        pelaaja1.Y = -10; 
     
    93103       PlatformCharacter vihollinen = new PlatformCharacter(40, 40); 
    94104       vihollinen.Shape = Shapes.Circle; 
     105       vihollinen.Image = LoadImage("Warrior"); 
    95106       vihollinen.Mass = 10.0; 
    96107       Add(vihollinen); 
     
    98109       vihollinen. X= 300; 
    99110       vihollinen.Tag = "vihollinen"; 
    100        vihollinen.Weapon = new AssaultRifle(70, 20); 
     111       AddCollisionHandler(vihollinen, KasitteleVihollisenTormays); 
     112 
     113       AssaultRifle    pyssy = new AssaultRifle    (40, 5); 
     114       vihollinen.Weapon = pyssy ; 
     115 
     116 
    101117 
    102118       return vihollinen; 
     
    105121    void Ammu() 
    106122    { 
    107         vihollinen.Weapon.Shoot(); 
     123        PhysicsObject ammus = vihollinen.Weapon.Shoot(); 
     124        if (ammus != null) 
     125        { 
     126            ammus.Tag = "vihollisammus"; 
     127        } 
     128 
    108129    } 
    109130 
     
    123144       { 
    124145           kohde.Destroy(); 
    125        } 
    126    } 
    127  
    128  
    129  
    130  
     146           pisteLaskuri.Value++; 
     147           pisteLaskuri.Value += 1; 
     148           pisteLaskuri.Value = pisteLaskuri.Value + 1; 
     149       } 
     150       if (kohde.Tag.ToString() == "vihollisammus") 
     151       { 
     152           pelaaja1.Destroy(); 
     153            
     154       } 
     155   } 
     156    
     157 
     158   void LuoLaskuri() 
     159   { 
     160       pisteLaskuri = new IntMeter(0); 
     161 
     162       Label pisteNaytto = new Label(); 
     163       pisteNaytto.X = Screen.Left + 100; 
     164       pisteNaytto.Y = Screen.Top - 100; 
     165       pisteNaytto.TextColor = Color.Black; 
     166 
     167       pisteNaytto.BindTo(pisteLaskuri); 
     168       Add(pisteNaytto); 
     169 
     170       Label pisteTeksti = new Label("Pisteet: "); 
     171       pisteTeksti.X = Screen.Left + 50; 
     172       pisteTeksti.Y = Screen.Top - 100; 
     173       pisteTeksti.TextColor = Color.Black; 
     174       Add(pisteTeksti); 
     175 
     176 
     177 
     178   } 
     179 
     180   void LuoHPBar() 
     181   { 
     182       pisteLaskuri2 = new IntMeter(0); 
     183 
     184       Label pisteNaytto2 = new Label(); 
     185       pisteNaytto2.X = Screen.Left  +250; 
     186       pisteNaytto2.Y = Screen.Top -100; 
     187       pisteNaytto2.TextColor = Color.Black; 
     188 
     189       pisteNaytto2.BindTo(pisteLaskuri2); 
     190       Add(pisteNaytto2); 
     191 
     192       Label pisteTeksti2 = new Label("Rakennus: "); 
     193       pisteTeksti2.X = Screen.Left + 190; 
     194       pisteTeksti2.Y = Screen.Top -100; 
     195       pisteTeksti2.TextColor = Color.Black; 
     196       Add(pisteTeksti2); 
     197 
     198 
     199 
     200       voimaMittari = new DoubleMeter(60); 
     201       voimaMittari.MaxValue = 60; 
     202       BarGauge voimaPalkki = new BarGauge(10, 150); 
     203       voimaPalkki.BindTo(voimaMittari); 
     204       Add(voimaPalkki); 
     205       voimaPalkki.X = (0.85 * Screen.LeftSafe); 
     206       voimaPalkki.Y = (0.05 * Screen.Height); 
     207       voimaPalkki.BarColor = Color.Aqua; 
     208       voimaPalkki.BorderColor = Color.Black; 
     209       voimaPalkki.Angle = Angle.Degrees(90); 
     210       voimaMittari.LowerLimit += new Meter<double>.OnLimitHandler(peliLoppuu); 
     211 
     212 
     213   } 
     214 
     215   void peliLoppuu(double value) 
     216   { 
     217       Exit(); 
     218   } 
     219 
     220   void KasitteleVihollisenTormays(PhysicsObject Vihollinen, PhysicsObject kohde) 
     221   { 
     222       if (kohde.Tag.ToString() == "talo") 
     223       { 
     224           Vihollinen.X = Vihollinen.X + 50; 
     225           voimaMittari.Value--; 
     226       } 
     227   } 
    131228 
    132229} 
Note: See TracChangeset for help on using the changeset viewer.