Changeset 1406 for 2010/27


Ignore:
Timestamp:
2010-07-29 14:50:46 (13 years ago)
Author:
aajokahe
Message:

Nurinam peli sai jatkuvasti tulevat vihulaiset, grafiikka parani ja Nurinam osaa ampua ninjatähtiä.

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

Legend:

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

    r1377 r1406  
    5757    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 
    5858  </ItemGroup> 
     59  <ItemGroup> 
     60    <Compile Include="Background.png"> 
     61      <Name>Background</Name> 
     62      <Importer>TextureImporter</Importer> 
     63      <Processor>TextureProcessor</Processor> 
     64    </Compile> 
     65  </ItemGroup> 
     66  <ItemGroup> 
     67    <Compile Include="Nurinam%27s house.png"> 
     68      <Name>Nurinam%27s house</Name> 
     69      <Importer>TextureImporter</Importer> 
     70      <Processor>TextureProcessor</Processor> 
     71    </Compile> 
     72  </ItemGroup> 
     73  <ItemGroup> 
     74    <Compile Include="Nurinam2.png"> 
     75      <Name>Nurinam2</Name> 
     76      <Importer>TextureImporter</Importer> 
     77      <Processor>TextureProcessor</Processor> 
     78    </Compile> 
     79  </ItemGroup> 
     80  <ItemGroup> 
     81    <Compile Include="Enemy.png"> 
     82      <Name>Enemy</Name> 
     83      <Importer>TextureImporter</Importer> 
     84      <Processor>TextureProcessor</Processor> 
     85    </Compile> 
     86  </ItemGroup> 
     87  <ItemGroup> 
     88    <Compile Include="Ak 47.png"> 
     89      <Name>Ak 47</Name> 
     90      <Importer>TextureImporter</Importer> 
     91      <Processor>TextureProcessor</Processor> 
     92    </Compile> 
     93  </ItemGroup> 
     94  <ItemGroup> 
     95    <Compile Include="Ak-47.png"> 
     96      <Name>Ak-47</Name> 
     97      <Importer>TextureImporter</Importer> 
     98      <Processor>TextureProcessor</Processor> 
     99    </Compile> 
     100  </ItemGroup> 
     101  <ItemGroup> 
     102    <Compile Include="Ninja Star.png"> 
     103      <Name>Ninja Star</Name> 
     104      <Importer>TextureImporter</Importer> 
     105      <Processor>TextureProcessor</Processor> 
     106    </Compile> 
     107  </ItemGroup> 
    59108  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    60109  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2010/27/Aajokahe/Nurinams adventure/Peli.cs

    r1377 r1406  
    33using Jypeli.Widgets; 
    44using Jypeli.Assets; 
     5using Jypeli.Effects; 
     6 
     7 
    58 
    69 
     
    1518 
    1619    PlatformCharacter pelaaja1; 
    17     PlatformCharacter vihollinen; 
     20    //PlatformCharacter vihollinen; 
    1821 
    1922    //pyssy = new AssaultRifle(70, 20); 
    2023 
     24    Image taustaKuva = LoadImage("Background"); 
     25 
     26 
    2127    protected override void Begin() 
    22     { 
     28     { 
    2329        Gravity = new Vector(0, -1000); 
    2430 
    2531        luoKentta(); 
    2632        lisaaNappaimet(); 
    27         vihollinen=LuoVihollinen(); 
    28         LuoLaskuri(); 
     33        LuoVihollinen(); 
     34        LuoLaskuri( ); 
    2935        LuoHPBar(); 
     36        LuoAjastin(); 
     37        AmmuAseella(); 
     38        Level.Background.Image = taustaKuva; 
    3039 
    3140        Camera.Follow(pelaaja1); 
     
    3342        Camera.StayInLevel = true; 
    3443        MessageDisplay.Add("sotalordin miehet ovat löytäneet sinun piilopaikkasi ja rynnivät sitä päin kiväärit tanassa. Sinun täytyy puolustaa piilopaikkaasi."); 
     44        MessageDisplay.TextColor = Color.Red; 
     45 
     46    } 
     47 
     48    void LuoAjastin() 
     49    { 
     50        Timer ajastin = new Timer(); 
     51        ajastin.Interval = 5.5; 
     52        ajastin.Trigger += lisaaVihollisia; 
     53        Add(ajastin); 
     54        ajastin.Start(); 
    3555 
    3656    } 
     
    5575        Add(taso); 
    5676        taso.Tag = "talo"; 
     77        taso.Image = LoadImage("Nurinam's house"); 
    5778 
    5879    } 
     
    6283        pelaaja1 = new PlatformCharacter (40, 40); 
    6384        pelaaja1.Mass = 4.0; 
    64         pelaaja1.Image = LoadImage("Nurinam ninja"); 
     85        pelaaja1.Image = LoadImage("Nurinam2"); 
    6586        pelaaja1.X = -400; 
    6687        pelaaja1.Y = -10; 
    6788        AddCollisionHandler(pelaaja1 , KasittelePelaaja1Tormays); 
     89        pelaaja1.Weapon = new AssaultRifle  (0.1, 0.1); 
     90 
    6891        Add(pelaaja1); 
    6992 
     
    81104        Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 
    82105        Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 
     106        Keyboard.Listen(Key.C, ButtonState.Down, AmmuAseella, "Ammu"); 
     107 
    83108 
    84109        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
     
    103128       PlatformCharacter vihollinen = new PlatformCharacter(40, 40); 
    104129       vihollinen.Shape = Shapes.Circle; 
    105        vihollinen.Image = LoadImage("Warrior"); 
     130       vihollinen.Image = LoadImage("Enemy"); 
    106131       vihollinen.Mass = 10.0; 
    107132       Add(vihollinen); 
    108        vihollinen.Y = 0; 
    109        vihollinen. X= 300; 
     133       vihollinen.Y = -300; 
     134       vihollinen. X= +450; 
    110135       vihollinen.Tag = "vihollinen"; 
    111136       AddCollisionHandler(vihollinen, KasitteleVihollisenTormays); 
    112137 
    113        AssaultRifle    pyssy = new AssaultRifle    (40, 5); 
     138       AssaultRifle    pyssy = new AssaultRifle    (50, 10); 
     139       pyssy.Image = LoadImage ("Ak-47"); 
    114140       vihollinen.Weapon = pyssy ; 
    115141 
    116  
     142       Timer kavelyajastin = new Timer(); 
     143       kavelyajastin.Interval = 0.01; 
     144       kavelyajastin.Trigger += Viholliskavely; 
     145       kavelyajastin.Tag = vihollinen; 
     146       kavelyajastin.Start(); 
     147       Add(kavelyajastin); 
    117148 
    118149       return vihollinen; 
    119150     } 
    120151     
    121     void Ammu() 
     152    void Ammu(PlatformCharacter vihollinen) 
    122153    { 
    123154        PhysicsObject ammus = vihollinen.Weapon.Shoot(); 
     
    129160    } 
    130161 
     162    void Viholliskavely(Timer ajastin) 
     163    { 
     164        PlatformCharacter vihollinen = ((PlatformCharacter)ajastin.Tag); 
     165 
     166        vihollinen.Walk(-70); 
     167        if ((pelaaja1.Y < vihollinen.Y + 10) && (pelaaja1.Y > vihollinen.Y - 10)) 
     168        { 
     169            Ammu(vihollinen); 
     170        } 
     171    } 
     172 
    131173   protected override void Update(Time time) 
    132174   { 
    133        vihollinen.Walk(-70); 
    134        if ((pelaaja1.Y < vihollinen.Y + 10) && (pelaaja1.Y > vihollinen.Y - 10)) 
    135        { 
    136            Ammu(); 
    137        } 
    138175       base.Update(time); 
    139         
    140176   } 
    141177   void KasittelePelaaja1Tormays(PhysicsObject pelaaja1, PhysicsObject kohde) 
     
    151187       { 
    152188           pelaaja1.Destroy(); 
     189           Exit(); 
    153190            
    154191       } 
     
    163200       pisteNaytto.X = Screen.Left + 100; 
    164201       pisteNaytto.Y = Screen.Top - 100; 
    165        pisteNaytto.TextColor = Color.Black; 
     202       pisteNaytto.TextColor = Color.DarkRed ; 
    166203 
    167204       pisteNaytto.BindTo(pisteLaskuri); 
     
    171208       pisteTeksti.X = Screen.Left + 50; 
    172209       pisteTeksti.Y = Screen.Top - 100; 
    173        pisteTeksti.TextColor = Color.Black; 
     210       pisteTeksti.TextColor = Color.DarkRed; 
    174211       Add(pisteTeksti); 
    175212 
     
    181218   { 
    182219       pisteLaskuri2 = new IntMeter(0); 
    183  
    184220       Label pisteNaytto2 = new Label(); 
    185        pisteNaytto2.X = Screen.Left  +250; 
    186        pisteNaytto2.Y = Screen.Top -100; 
    187        pisteNaytto2.TextColor = Color.Black; 
     221       pisteNaytto2.X = Screen.Left  -700; 
     222       pisteNaytto2.Y = Screen.Top -700; 
     223       pisteNaytto2.TextColor = Color.Red; 
    188224 
    189225       pisteNaytto2.BindTo(pisteLaskuri2); 
     
    191227 
    192228       Label pisteTeksti2 = new Label("Rakennus: "); 
    193        pisteTeksti2.X = Screen.Left + 190; 
    194        pisteTeksti2.Y = Screen.Top -100; 
    195        pisteTeksti2.TextColor = Color.Black; 
     229       pisteTeksti2.X = Screen.Left -700; 
     230       pisteTeksti2.Y = Screen.Top -700; 
     231       pisteTeksti2.TextColor = Color.Red; 
    196232       Add(pisteTeksti2); 
    197233 
    198234 
    199235 
    200        voimaMittari = new DoubleMeter(60); 
    201        voimaMittari.MaxValue = 60; 
     236       voimaMittari = new DoubleMeter(5); 
     237       voimaMittari.MaxValue = 5; 
    202238       BarGauge voimaPalkki = new BarGauge(10, 150); 
    203239       voimaPalkki.BindTo(voimaMittari); 
     
    205241       voimaPalkki.X = (0.85 * Screen.LeftSafe); 
    206242       voimaPalkki.Y = (0.05 * Screen.Height); 
    207        voimaPalkki.BarColor = Color.Aqua; 
     243       voimaPalkki.BarColor = Color.Red; 
    208244       voimaPalkki.BorderColor = Color.Black; 
    209245       voimaPalkki.Angle = Angle.Degrees(90); 
     
    227263   } 
    228264 
     265   void lisaaVihollisia(Timer sender) 
     266   { 
     267       LuoVihollinen(); 
     268   } 
     269   void AmmuAseella() 
     270   { 
     271       PhysicsObject Ninjatähti = pelaaja1.Weapon.Shoot(); 
     272 
     273       if (Ninjatähti != null) 
     274       { 
     275           Ninjatähti.Size = new Vector(10, 10); 
     276           Ninjatähti.Image = LoadImage("Ninja Star"); 
     277 
     278       } 
     279        
     280   } 
     281   void KasitteleNinjatahdenTormays(PhysicsObject Ninjatähti, PhysicsObject kohde) 
     282   { 
     283       if (kohde.Tag.ToString() == "vihollinen") 
     284       { 
     285           kohde.Destroy(); 
     286       } 
     287   } 
     288 
     289 
    229290} 
Note: See TracChangeset for help on using the changeset viewer.