Changeset 1203 for 2010/27


Ignore:
Timestamp:
2010-07-08 14:58:29 (13 years ago)
Author:
paaaanro
Message:

tausta, iskut

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

Legend:

Unmodified
Added
Removed
  • 2010/27/heikriin/CrabsAndShrimps

    • Property svn:ignore set to
      paistinpannu%20kuumana.jpg
  • 2010/27/heikriin/CrabsAndShrimps/Content/Content.contentproj

    r1152 r1203  
    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>695befa7-ead2-4032-9be5-de8f56484d50</ProjectGuid> 
     
    3434    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 
    3535  </ItemGroup> 
     36  <ItemGroup> 
     37    <Compile Include="paistinpannukuumana2.PNG"> 
     38      <Name>paistinpannukuumana2</Name> 
     39      <Importer>TextureImporter</Importer> 
     40      <Processor>TextureProcessor</Processor> 
     41    </Compile> 
     42  </ItemGroup> 
    3643</Project> 
  • 2010/27/heikriin/CrabsAndShrimps/CrabsAndShrimps.csproj

    r1152 r1203  
    5757  </PropertyGroup> 
    5858  <ItemGroup> 
    59     <Reference Include="Jypeli2, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> 
     59    <Reference Include="Jypeli2, Version=2.2.3.0, Culture=neutral, processorArchitecture=x86"> 
    6060      <SpecificVersion>False</SpecificVersion> 
    6161      <HintPath>..\..\lib\Jypeli2.dll</HintPath> 
  • 2010/27/heikriin/CrabsAndShrimps/Peli.cs

    r1152 r1203  
    1010    PlatformCharacter katkis; 
    1111    PlatformCharacter rapu; 
     12    GameObject pannu; 
     13    GameObject kukka; 
     14 
     15    IntMeter pisteLaskuri; 
     16    IntMeter katkisElamat, rapuElamat; 
     17 
     18  
    1219 
    1320    protected override void Begin() 
     
    1522        AloitaPeli(); 
    1623        luoKentta(); 
    17         LisaaLaskurit(); 
    18  
     24        
    1925        katkis = new PlatformCharacter(220.0, 220.0); 
    2026        Add(katkis); 
    21         katkis.Mass = 4.0; 
     27        katkis.Mass = 3.0; 
    2228        katkis.X = 380.0; 
    2329        katkis.Y = -250.0; 
     30 
     31        //pannu = new GameObject(500, 500); 
     32        //pannu.Color = Color.Red; 
     33        //pannu.Tag = "pannu"; 
     34        //Add(pannu); 
     35        //katkis.Add(pannu); 
    2436 
    2537        rapu = new PlatformCharacter(300.0, 300.0); 
     
    2840        rapu.X = -380.0; 
    2941        rapu.Y = -200.0; 
     42 
     43        //kukka = new GameObject(500, 500); 
     44        //kukka.Color = Color.Red; 
     45        //rapu.Add(kukka); 
     46         
     47        AddCollisionHandler(katkis, katkisTormaa); 
     48        AddCollisionHandler(rapu, rapuTormaa); 
    3049 
    3150        Level.CreateBorders(false); 
     
    3655        Gravity = new Vector(0.0, -800.0); 
    3756        lisaaNappaimet(); 
     57        LuoLaskuri(); 
    3858    } 
    3959 
     
    4666        Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", katkis, 100.0); 
    4767        Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", katkis, hyppyVoima); 
    48         Keyboard.Listen(Key.M, ButtonState.Pressed, katkisiskee, "Paistinpannu", katkis, 100.0); 
     68        Keyboard.Listen(Key.M, ButtonState.Pressed, katkisiskee, "Paistinpannu"); 
    4969 
    5070        Keyboard.Listen(Key.A, ButtonState.Down, liikuta, "Liikkuu vasemmalle", rapu, -100.0); 
    5171        Keyboard.Listen(Key.D, ButtonState.Down, liikuta, "Liikkuu oikealle", rapu, 100.0); 
    5272        Keyboard.Listen(Key.W, ButtonState.Pressed, hyppaa, "Hyppää", rapu, hyppyVoima); 
     73        Keyboard.Listen(Key.Q, ButtonState.Pressed, rapuiskee, "Kukka"); 
     74    } 
     75 
     76    void katkisiskee() 
     77    { 
     78        if(katkis.X - rapu.X < 300) 
     79        { 
     80            rapuElamat.Value -=3; 
     81        } 
     82    } 
     83 
     84    void rapuiskee() 
     85    { 
     86        if(rapu.X - katkis.X < 300) 
     87        { 
     88            katkisElamat.Value -=3; 
     89        } 
     90 
     91        if (katkisElamat.Value <= 0) 
     92        { 
     93            MessageDisplay.Add("RAPU VOITTI."); 
     94        } 
     95         
    5396    } 
    5497 
     
    66109    { 
    67110        Level.CreateBorders(); 
    68         Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
     111        Level.Background.Image = LoadImage("paistinpannukuumana2"); 
    69112    } 
     113 
     114    void katkisTormaa(PhysicsObject katkis, PhysicsObject kohde) 
     115    { 
     116        //if (kohde.Tag.ToString() == "pannu") 
     117        //{ 
     118        //    MessageDisplay.Add("katkikseen osui"); 
     119        //} 
     120    } 
     121 
     122    void rapuTormaa(PhysicsObject rapu, PhysicsObject kohde) 
     123    { 
     124 
     125    } 
     126    void LuoLaskuri() 
     127    { 
     128        pisteLaskuri = new IntMeter(100); 
     129 
     130        katkisElamat = new IntMeter(100); 
     131        rapuElamat = new IntMeter(100); 
     132 
     133        Label katkisNaytto = new Label(100.0, 60.0); 
     134        katkisNaytto.X = Screen.Right - 100; 
     135        katkisNaytto.Y = Screen.Top - 50; 
     136        katkisNaytto.TextColor = Color.White; 
     137        katkisNaytto.Color = Color.Black; 
     138 
     139        katkisNaytto.BindTo(katkisElamat); 
     140        Add(katkisNaytto); 
     141 
     142        Label rapuNaytto = new Label(100.0, 60.0); 
     143        rapuNaytto.X = Screen.Left + 100; 
     144        rapuNaytto.Y = Screen.Top - 50; 
     145        rapuNaytto.TextColor = Color.White; 
     146        rapuNaytto.Color = Color.Black; 
     147 
     148        rapuNaytto.BindTo(rapuElamat); 
     149        Add(rapuNaytto); 
     150 
     151    } 
     152 
     153     
    70154 
    71155    void AloitaPeli() 
    72156    { } 
    73157 
    74     void LisaaLaskurit() 
    75     { 
    76         LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 
    77         LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 
     158     
    78159 
    79     } 
    80160 
    81     IntMeter LuoPisteLaskuri(double x, double y) 
    82     { 
    83         IntMeter laskuri = new IntMeter(0); 
    84         laskuri.MaxValue = 10; 
    85         Label naytto = new Label(); 
    86         naytto.BindTo(laskuri); 
    87         naytto.X = x; 
    88         naytto.Y = y; 
    89         naytto.TextColor = Color.White; 
    90         Add(naytto); 
    91         return laskuri; 
    92     } 
    93  
    94     void katkisiskee(PlatformCharacter katkis, PlatformCharacter rapu) 
    95     { 
    96         if (katkis == rapu) 
    97         { 
    98             katkis.Value -= 1; 
    99         } 
    100         else if (rapu == katkis) 
    101         { 
    102             rapu.Value -= 1; 
    103         } 
    104     } 
    105161 
    106162 
Note: See TracChangeset for help on using the changeset viewer.