Changeset 6267 for 2015/26


Ignore:
Timestamp:
2015-06-24 14:58:31 (8 years ago)
Author:
patlahti
Message:
 
Location:
2015/26/PatrikL
Files:
12 added
2 deleted
19 edited

Legend:

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

    r6191 r6267  
    99public class Soccer : PhysicsGame 
    1010{ 
    11     const double nopeus = 200; 
    12     const double hyppyNopeus = 750; 
     11    const double nopeus = 300; 
     12    const double hyppyNopeus = 800; 
    1313    const int RUUDUN_KOKO = 40; 
    1414 
    1515    PlatformCharacter pelaaja1; 
     16    PlatformCharacter pelaaja2; 
    1617 
    17     Image pelaajanKuva = LoadImage("norsu"); 
     18     
    1819    Image tahtiKuva = LoadImage("tahti"); 
    19  
    20     SoundEffect maaliAani = LoadSoundEffect("maali"); 
     20    Image pelaajan1Kuva = LoadImage("Tyyppi3"); 
     21    Image pelaajan2Kuva = LoadImage("tyyppi2"); 
     22    Image MaalinKuva = LoadImage("Maali"); 
    2123 
    2224    public override void Begin() 
    2325    { 
    24         Gravity = new Vector(0, -900); 
     26        Gravity = new Vector(0, -1400); 
    2527 
    2628        LuoKentta(); 
    2729        LisaaNappaimet(); 
    2830 
    29         Camera.Follow(pelaaja1); 
    30         Camera.ZoomFactor = 1.2; 
    31         Camera.StayInLevel = true; 
     31        //Camera.Follow(pelaaja1, pelaaja2); 
     32        //Camera.ZoomFactor = 1.5; 
     33        //Camera.StayInLevel = false; 
     34        Camera.ZoomToLevel(); 
    3235    } 
    3336 
     
    3740        kentta.SetTileMethod('#', LisaaTaso); 
    3841        kentta.SetTileMethod('*', LisaaTahti); 
    39         kentta.SetTileMethod('N', LisaaPelaaja); 
     42        kentta.SetTileMethod('1', LisaaPelaaja); 
     43        kentta.SetTileMethod('2', LisaaPelaaja2); 
     44        kentta.SetTileMethod('M', LisaaMaali); 
    4045        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    41         Level.CreateBorders(); 
    4246        Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
     47        Surfaces reunat = Level.CreateBorders(); 
     48 
     49        foreach (var reuna in reunat) 
     50            reuna.Color = Color.Black; 
    4351    } 
     52 
    4453 
    4554    void LisaaTaso(Vector paikka, double leveys, double korkeus) 
     
    6675        pelaaja1.Position = paikka; 
    6776        pelaaja1.Mass = 4.0; 
    68         pelaaja1.Image = pelaajanKuva; 
    69         AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
     77        pelaaja1.Image = pelaajan1Kuva; 
    7078        Add(pelaaja1); 
     79        pelaaja1.Width = 100; 
     80        pelaaja1.Height = 100; 
     81    } 
     82    void LisaaMaali(); 
     83 
     84    void LisaaPelaaja2(Vector paikka, double leveys, double korkeus) 
     85    { 
     86        pelaaja2 = new PlatformCharacter(leveys, korkeus); 
     87        pelaaja2.Position = paikka; 
     88        pelaaja2.Mass = 4.0; 
     89        pelaaja2.Image = pelaajan2Kuva; 
     90        Add(pelaaja2); 
     91        pelaaja2.Width = 100; 
     92        pelaaja2.Height = 100; 
    7193    } 
    7294 
     
    80102        Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 
    81103 
     104        Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); 
     105        Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, nopeus); 
     106        Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja2, hyppyNopeus); 
     107 
    82108        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
    83109 
     
    85111        ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 
    86112        ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 
     113 
     114        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 
     115 
     116        ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja2, -nopeus); 
     117        ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja2, nopeus); 
     118        ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja2, hyppyNopeus); 
    87119 
    88120        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
     
    99131    } 
    100132 
    101     void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 
    102     { 
    103         maaliAani.Play(); 
    104         MessageDisplay.Add("Keräsit tähden!"); 
    105         tahti.Destroy(); 
    106     } 
     133    
    107134} 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/Soccer.csproj.Debug.cachefile

    r6191 r6267  
    1 Content\maali.xnb 
    21Content\norsu.xnb 
    32Content\tahti.xnb 
    43Content\kentta1.xnb 
     4Content\Tyyppi3.xnb 
     5Content\Maali.xnb 
     6Content\tyyppi2.xnb 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/ContentPipeline-{F106661A-C7EB-416D-A109-33F8C01CB95C}.xml

    r6191 r6267  
    22<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 
    33  <Asset Type="Pipeline:BuildItemCollection"> 
    4     <Item> 
    5       <Source>maali.wav</Source> 
    6       <Name>maali</Name> 
    7       <Importer>WavImporter</Importer> 
    8       <Processor>SoundEffectProcessor</Processor> 
    9       <Options>None</Options> 
    10       <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\maali.xnb</Output> 
    11       <Time>2015-06-23T13:28:35.6902559+03:00</Time> 
    12     </Item> 
    134    <Item> 
    145      <Source>norsu.png</Source> 
     
    3627      <Options>None</Options> 
    3728      <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2015-06-23T13:31:17.0002559+03:00</Time> 
     29      <Time>2015-06-24T14:28:40.5150977+03:00</Time> 
     30    </Item> 
     31    <Item> 
     32      <Source>Tyyppi3.png</Source> 
     33      <Name>Tyyppi3</Name> 
     34      <Importer>TextureImporter</Importer> 
     35      <Processor>TextureProcessor</Processor> 
     36      <Options>None</Options> 
     37      <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> 
     39    </Item> 
     40    <Item> 
     41      <Source>Maali.png</Source> 
     42      <Name>Maali</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <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> 
     48    </Item> 
     49    <Item> 
     50      <Source>tyyppi2.png</Source> 
     51      <Name>tyyppi2</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <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> 
    3957    </Item> 
    4058    <BuildSuccessful>true</BuildSuccessful> 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/Soccer.csproj.FileListAbsolute.txt

    r6191 r6267  
    1111C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\obj\x86\Debug\Soccer.exe 
    1212C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\obj\x86\Debug\Soccer.pdb 
     13C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Tyyppi3.xnb 
     14C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\tyyppi2.xnb 
  • 2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/cachefile-{F106661A-C7EB-416D-A109-33F8C01CB95C}-targetpath.txt

    r6191 r6267  
    1 Content\maali.xnb 
    21Content\norsu.xnb 
    32Content\tahti.xnb 
    43Content\kentta1.xnb 
     4Content\Tyyppi3.xnb 
     5Content\Maali.xnb 
     6Content\tyyppi2.xnb 
  • 2015/26/PatrikL/Soccer/Soccer/SoccerContent/SoccerContent.contentproj

    r6191 r6267  
    4646  </ItemGroup> 
    4747  <ItemGroup> 
    48     <Compile Include="maali.wav"> 
    49       <Name>maali</Name> 
    50       <Importer>WavImporter</Importer> 
    51       <Processor>SoundEffectProcessor</Processor> 
    52     </Compile> 
    5348    <Compile Include="norsu.png"> 
    5449      <Name>norsu</Name> 
     
    6762    </Compile> 
    6863  </ItemGroup> 
     64  <ItemGroup> 
     65    <Compile Include="Tyyppi3.png"> 
     66      <Name>Tyyppi3</Name> 
     67      <Importer>TextureImporter</Importer> 
     68      <Processor>TextureProcessor</Processor> 
     69    </Compile> 
     70  </ItemGroup> 
     71  <ItemGroup> 
     72    <Compile Include="Maali.png"> 
     73      <Name>Maali</Name> 
     74      <Importer>TextureImporter</Importer> 
     75      <Processor>TextureProcessor</Processor> 
     76    </Compile> 
     77  </ItemGroup> 
     78  <ItemGroup> 
     79    <Compile Include="tyyppi2.png"> 
     80      <Name>tyyppi2</Name> 
     81      <Importer>TextureImporter</Importer> 
     82      <Processor>TextureProcessor</Processor> 
     83    </Compile> 
     84  </ItemGroup> 
    6985  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    7086  <!--  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

    r6191 r6267  
    44        
    55 
    6         N 
     6    1       M  2 
    77###################### 
Note: See TracChangeset for help on using the changeset viewer.