Changeset 1223 for 2010/27


Ignore:
Timestamp:
2010-07-09 12:47:51 (13 years ago)
Author:
paaaanro
Message:

Jee jee valmis... melkein

Location:
2010/27/heikriin/CrabsAndShrimps
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/heikriin/CrabsAndShrimps/Content/Content.contentproj

    r1203 r1223  
    4141    </Compile> 
    4242  </ItemGroup> 
     43  <ItemGroup> 
     44    <Compile Include="rapu.png"> 
     45      <Name>rapu</Name> 
     46      <Importer>TextureImporter</Importer> 
     47      <Processor>TextureProcessor</Processor> 
     48    </Compile> 
     49  </ItemGroup> 
     50  <ItemGroup> 
     51    <Compile Include="katkis.png"> 
     52      <Name>katkis</Name> 
     53      <Importer>TextureImporter</Importer> 
     54      <Processor>TextureProcessor</Processor> 
     55    </Compile> 
     56  </ItemGroup> 
     57  <ItemGroup> 
     58    <Compile Include="rapuiskee.png"> 
     59      <Name>rapuiskee</Name> 
     60      <Importer>TextureImporter</Importer> 
     61      <Processor>TextureProcessor</Processor> 
     62    </Compile> 
     63  </ItemGroup> 
     64  <ItemGroup> 
     65    <Compile Include="katkisiskee.png"> 
     66      <Name>katkisiskee</Name> 
     67      <Importer>TextureImporter</Importer> 
     68      <Processor>TextureProcessor</Processor> 
     69    </Compile> 
     70  </ItemGroup> 
     71  <ItemGroup> 
     72    <Compile Include="bang.png"> 
     73      <Name>bang</Name> 
     74      <Importer>TextureImporter</Importer> 
     75      <Processor>TextureProcessor</Processor> 
     76    </Compile> 
     77  </ItemGroup> 
     78  <ItemGroup> 
     79    <Compile Include="loyh.png"> 
     80      <Name>loyh</Name> 
     81      <Importer>TextureImporter</Importer> 
     82      <Processor>TextureProcessor</Processor> 
     83    </Compile> 
     84  </ItemGroup> 
    4385</Project> 
  • 2010/27/heikriin/CrabsAndShrimps/Peli.cs

    r1203 r1223  
    11using System; 
    22using Jypeli; 
     3using Jypeli.Effects; 
    34using Jypeli.Widgets; 
    45using Jypeli.Assets; 
     
    1011    PlatformCharacter katkis; 
    1112    PlatformCharacter rapu; 
    12     GameObject pannu; 
    13     GameObject kukka; 
     13 
     14 
    1415 
    1516    IntMeter pisteLaskuri; 
     
    2223        AloitaPeli(); 
    2324        luoKentta(); 
     25 
     26 
    2427        
    2528        katkis = new PlatformCharacter(220.0, 220.0); 
     
    2831        katkis.X = 380.0; 
    2932        katkis.Y = -250.0; 
     33        katkis.Image = LoadImage("katkis"); 
     34         
    3035 
    3136        //pannu = new GameObject(500, 500); 
     
    4045        rapu.X = -380.0; 
    4146        rapu.Y = -200.0; 
     47        rapu.Image = LoadImage("rapu"); 
    4248 
    4349        //kukka = new GameObject(500, 500); 
    4450        //kukka.Color = Color.Red; 
    4551        //rapu.Add(kukka); 
     52 
    4653         
    4754        AddCollisionHandler(katkis, katkisTormaa); 
     
    7178        Keyboard.Listen(Key.D, ButtonState.Down, liikuta, "Liikkuu oikealle", rapu, 100.0); 
    7279        Keyboard.Listen(Key.W, ButtonState.Pressed, hyppaa, "Hyppää", rapu, hyppyVoima); 
    73         Keyboard.Listen(Key.Q, ButtonState.Pressed, rapuiskee, "Kukka"); 
    74     } 
     80        Keyboard.Listen(Key.Q, ButtonState.Pressed, rapuiskee, "Kukka");   
     81 
     82    } 
     83     
     84 
     85     
     86     
    7587 
    7688    void katkisiskee() 
    7789    { 
    78         if(katkis.X - rapu.X < 300) 
    79         { 
    80             rapuElamat.Value -=3; 
     90        Image[] katkisKuvat = LoadImages("katkis", "katkisiskee", "katkisiskee", "katkisiskee"); 
     91        katkis.Animation = new Animation(katkisKuvat); 
     92        katkis.Animation.Start(1); 
     93        Vector etaisyys = new Vector(katkis.X - rapu.X, katkis.Y - rapu.Y); 
     94        if(etaisyys.Magnitude < 300) 
     95        { 
     96            rapuElamat.Value -=5; 
     97            ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("bang"), 1); 
     98            Add(rajahdys); 
     99            rajahdys.AddEffect(0, 0, 1); 
     100        } 
     101 
     102        if (rapuElamat.Value <= 0) 
     103        { 
     104            LopetusRuutu(); 
     105            MessageDisplay.Add("KATKIS VOITTI"); 
    81106        } 
    82107    } 
     
    84109    void rapuiskee() 
    85110    { 
    86         if(rapu.X - katkis.X < 300) 
    87         { 
    88             katkisElamat.Value -=3; 
    89         } 
     111        Image[] rapuKuvat = LoadImages("rapu", "rapuiskee", "rapuiskee", "rapuiskee"); 
     112        rapu.Animation = new Animation(rapuKuvat); 
     113        rapu.Animation.Start(1); 
     114        Vector etaisyys = new Vector(katkis.X - rapu.X, katkis.Y - rapu.Y); 
     115        if (etaisyys.Magnitude < 300) 
     116 
     117        { 
     118            katkisElamat.Value -=5; 
     119 
     120            ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("loyh"), 1); 
     121            Add(rajahdys); 
     122            rajahdys.AddEffect(0, 0, 1); 
     123 
     124        } 
     125 
     126 
    90127 
    91128        if (katkisElamat.Value <= 0) 
    92129        { 
    93             MessageDisplay.Add("RAPU VOITTI."); 
    94         } 
     130            LopetusRuutu(); 
     131            MessageDisplay.Add("RAPU VOITTI"); 
     132        } 
     133 
     134 
    95135         
    96136    } 
     
    156196    { } 
    157197 
     198    void LopetusRuutu() 
     199    { 
     200        ClearAll(); 
     201         
     202        MessageDisplay.TextColor = Color.White; 
     203        MessageDisplay.Position = new Vector(00, 00); 
     204 
     205        Keyboard.Listen(Key.V,ButtonState.Pressed, Begin, null); 
     206 
     207 
     208    } 
     209 
     210 
     211 
    158212     
    159213 
Note: See TracChangeset for help on using the changeset viewer.