Changeset 6447 for 2015


Ignore:
Timestamp:
2015-06-26 11:31:12 (8 years ago)
Author:
patlahti
Message:
 
Location:
2015/26/PatrikL/Soccer
Files:
8 added
19 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/Soccer.cs

    r6267 r6447  
    2121    Image pelaajan2Kuva = LoadImage("tyyppi2"); 
    2222    Image MaalinKuva = LoadImage("Maali"); 
     23    Image tausta = LoadImage("Tausta"); 
     24    Image pallonKuva = LoadImage("pallo"); 
     25    IntMeter pelaajan1pistelaskuri = new IntMeter(0); 
     26    IntMeter pelaajan2pistelaskuri = new IntMeter(0); 
     27    int pelaajan1pisteet = 0; 
     28    int pelaajan2pisteet = 0; 
     29     
    2330 
    2431    public override void Begin() 
    2532    { 
     33 
     34        ClearAll(); 
    2635        Gravity = new Vector(0, -1400); 
    2736 
    2837        LuoKentta(); 
    2938        LisaaNappaimet(); 
     39 
    3040 
    3141        //Camera.Follow(pelaaja1, pelaaja2); 
     
    3949        TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
    4050        kentta.SetTileMethod('#', LisaaTaso); 
    41         kentta.SetTileMethod('*', LisaaTahti); 
     51        kentta.SetTileMethod('*', LisaaMaali); 
    4252        kentta.SetTileMethod('1', LisaaPelaaja); 
    4353        kentta.SetTileMethod('2', LisaaPelaaja2); 
    4454        kentta.SetTileMethod('M', LisaaMaali); 
     55        kentta.SetTileMethod('p', LisaaPallo); 
     56        kentta.SetTileMethod('m', LisaaMaali2); 
    4557        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    46         Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
    47         Surfaces reunat = Level.CreateBorders(); 
    48  
    49         foreach (var reuna in reunat) 
    50             reuna.Color = Color.Black; 
     58        Level.Background.Image = tausta; 
    5159    } 
    5260 
     
    6068    } 
    6169 
    62     void LisaaTahti(Vector paikka, double leveys, double korkeus) 
     70    void LisaaMaali(Vector paikka, double leveys, double korkeus) 
    6371    { 
    64         PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    65         tahti.IgnoresCollisionResponse = true; 
    66         tahti.Position = paikka; 
    67         tahti.Image = tahtiKuva; 
    68         tahti.Tag = "tahti"; 
    69         Add(tahti); 
     72        PhysicsObject Maali = PhysicsObject.CreateStaticObject(MaalinKuva); 
     73        Maali.IgnoresCollisionResponse = true; 
     74        Maali.Position = paikka; 
     75        Maali.Size = new Vector(leveys * 3, korkeus * 5); 
     76        Maali.Tag = "Maali"; 
     77        Maali.MirrorImage(); 
     78        AddCollisionHandler(Maali, "pallo", PalloMeneeMaaliin); 
     79        Add(Maali); 
     80    } 
     81    void LisaaMaali2(Vector paikka, double leveys, double korkeus) 
     82    { 
     83        PhysicsObject Maali = PhysicsObject.CreateStaticObject(MaalinKuva); 
     84        Maali.IgnoresCollisionResponse = true; 
     85        Maali.Position = paikka; 
     86        Maali.Size = new Vector(leveys * 3, korkeus * 5); 
     87        Maali.Tag = "Maali"; 
     88        AddCollisionHandler(Maali, "pallo", PalloMeneeMaaliin2); 
     89        Add(Maali); 
     90 
     91    } 
     92    void PalloMeneeMaaliin(PhysicsObject Maali, PhysicsObject pallo) 
     93    { 
     94        pelaajan1pistelaskuri.Value += 1; 
     95        pelaajan1pisteet = pelaajan1pistelaskuri.Value; 
     96        Timer.SingleShot(1, Begin); 
     97    } 
     98    void PalloMeneeMaaliin2(PhysicsObject Maali, PhysicsObject pallo) 
     99    { 
     100        pelaajan2pistelaskuri.Value += 1; 
     101        pelaajan2pisteet = pelaajan2pistelaskuri.Value; 
     102        Timer.SingleShot(1, Begin); 
     103    } 
     104    void LisaaPallo(Vector paikka, double leveys, double korkeus) 
     105    { 
     106        PhysicsObject pallo = new PhysicsObject(pallonKuva); 
     107        pallo.IgnoresCollisionResponse = false; 
     108        pallo.Position = paikka; 
     109        pallo.Size = new Vector(leveys * 1, korkeus * 1); 
     110        pallo.Tag = "pallo"; 
     111        pallo.Mass = 2.0; 
     112        Add(pallo); 
    70113    } 
    71114 
     
    76119        pelaaja1.Mass = 4.0; 
    77120        pelaaja1.Image = pelaajan1Kuva; 
     121        pelaaja1.Shape = Shape.FromImage(pelaajan1Kuva); 
    78122        Add(pelaaja1); 
    79         pelaaja1.Width = 100; 
    80         pelaaja1.Height = 100; 
     123        pelaaja1.Width = 50; 
     124        pelaaja1.Height = 110; 
     125        LuoPistelaskuri(Screen.Left + 100, Screen.Top - 100, pelaajan1pistelaskuri); 
    81126    } 
    82     void LisaaMaali(); 
    83127 
    84128    void LisaaPelaaja2(Vector paikka, double leveys, double korkeus) 
     
    88132        pelaaja2.Mass = 4.0; 
    89133        pelaaja2.Image = pelaajan2Kuva; 
     134        pelaaja2.Shape = Shape.FromImage(pelaajan2Kuva); 
    90135        Add(pelaaja2); 
    91         pelaaja2.Width = 100; 
    92         pelaaja2.Height = 100; 
     136        pelaaja2.Width = 50; 
     137        pelaaja2.Height = 110; 
     138        LuoPistelaskuri(Screen.Right - 100, Screen.Top - 100, pelaajan2pistelaskuri); 
    93139    } 
    94140 
     
    130176        hahmo.Jump(nopeus); 
    131177    } 
     178    void LuoPistelaskuri(double x, double y, IntMeter laskuri) 
     179    { 
     180         
     181 
     182        Label pisteNaytto = new Label(); 
     183        pisteNaytto.X = x;  
     184        pisteNaytto.Y = y;   
     185        pisteNaytto.TextColor = Color.Black; 
     186        pisteNaytto.Color = Color.White; 
     187 
     188        pisteNaytto.BindTo(laskuri); 
     189        Add(pisteNaytto); 
     190    } 
    132191 
    133192    
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/Soccer.csproj.Debug.cachefile

    r6267 r6447  
    55Content\Maali.xnb 
    66Content\tyyppi2.xnb 
     7Content\pallo.xnb 
     8Content\mario.xnb 
     9Content\tausta.xnb 
     10Content\mario.wma 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/ContentPipeline-{F106661A-C7EB-416D-A109-33F8C01CB95C}.xml

    r6267 r6447  
    2727      <Options>None</Options> 
    2828      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\kentta1.xnb</Output> 
    29       <Time>2015-06-24T14:28:40.5150977+03:00</Time> 
     29      <Time>2015-06-26T10:10:42.5939222+03:00</Time> 
    3030    </Item> 
    3131    <Item> 
     
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Tyyppi3.xnb</Output> 
    38       <Time>2015-06-24T13:23:50.9591977+03:00</Time> 
     38      <Time>2015-06-25T10:00:47.1951477+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    4545      <Options>None</Options> 
    4646      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Maali.xnb</Output> 
    47       <Time>2015-06-24T13:27:21.9921977+03:00</Time> 
     47      <Time>2015-06-25T10:03:29.9831477+03:00</Time> 
    4848    </Item> 
    4949    <Item> 
     
    5454      <Options>None</Options> 
    5555      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\tyyppi2.xnb</Output> 
    56       <Time>2015-06-24T14:06:35.3492977+03:00</Time> 
     56      <Time>2015-06-25T10:00:13.8265477+03:00</Time> 
     57    </Item> 
     58    <Item> 
     59      <Source>pallo.png</Source> 
     60      <Name>pallo</Name> 
     61      <Importer>TextureImporter</Importer> 
     62      <Processor>TextureProcessor</Processor> 
     63      <Options>None</Options> 
     64      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\pallo.xnb</Output> 
     65      <Time>2015-06-25T10:35:03.1529477+03:00</Time> 
     66    </Item> 
     67    <Item> 
     68      <Source>mario.mp3</Source> 
     69      <Name>mario</Name> 
     70      <Importer>Mp3Importer</Importer> 
     71      <Processor>SongProcessor</Processor> 
     72      <Options>None</Options> 
     73      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\mario.xnb</Output> 
     74      <Extra>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\mario.wma</Extra> 
     75      <Time>2015-06-25T13:02:18.9139719+03:00</Time> 
     76    </Item> 
     77    <Item> 
     78      <Source>tausta.jpg</Source> 
     79      <Name>tausta</Name> 
     80      <Importer>TextureImporter</Importer> 
     81      <Processor>TextureProcessor</Processor> 
     82      <Options>None</Options> 
     83      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\tausta.xnb</Output> 
     84      <Time>2015-06-26T10:02:01.1857907+03:00</Time> 
    5785    </Item> 
    5886    <BuildSuccessful>true</BuildSuccessful> 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/Soccer.csproj.FileListAbsolute.txt

    r6267 r6447  
    1313C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Tyyppi3.xnb 
    1414C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\tyyppi2.xnb 
     15C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\pallo.xnb 
     16C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\mario.xnb 
     17C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\mario.wma 
     18C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\tausta.xnb 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/cachefile-{F106661A-C7EB-416D-A109-33F8C01CB95C}-targetpath.txt

    r6267 r6447  
    55Content\Maali.xnb 
    66Content\tyyppi2.xnb 
     7Content\pallo.xnb 
     8Content\mario.xnb 
     9Content\mario.wma 
     10Content\tausta.xnb 
  • 2015/26/PatrikL/Soccer/Soccer/SoccerContent/SoccerContent.contentproj

    r6267 r6447  
    8383    </Compile> 
    8484  </ItemGroup> 
     85  <ItemGroup> 
     86    <Compile Include="pallo.png"> 
     87      <Name>pallo</Name> 
     88      <Importer>TextureImporter</Importer> 
     89      <Processor>TextureProcessor</Processor> 
     90    </Compile> 
     91  </ItemGroup> 
     92  <ItemGroup> 
     93    <Compile Include="mario.mp3"> 
     94      <Name>mario</Name> 
     95      <Importer>Mp3Importer</Importer> 
     96      <Processor>SongProcessor</Processor> 
     97    </Compile> 
     98  </ItemGroup> 
     99  <ItemGroup> 
     100    <Compile Include="tausta.jpg"> 
     101      <Name>tausta</Name> 
     102      <Importer>TextureImporter</Importer> 
     103      <Processor>TextureProcessor</Processor> 
     104    </Compile> 
     105  </ItemGroup> 
    85106  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    86107  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/26/PatrikL/Soccer/Soccer/SoccerContent/kentta1.txt

    r6267 r6447  
    1           
    2           
    3  
    4         
    5  
    6     1       M  2 
    7 ###################### 
     1#                                                       # 
     2#                     # 
     3#                               p               # 
     4#                                                       # 
     5#                     # 
     6#                     # 
     7#                           # 
     8# m                 M # 
     9#                           # 
     10#     1          2    # 
     11####################### 
Note: See TracChangeset for help on using the changeset viewer.