- Timestamp:
- 2015-06-24 14:58:31 (8 years ago)
- 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 9 9 public class Soccer : PhysicsGame 10 10 { 11 const double nopeus = 200;12 const double hyppyNopeus = 750;11 const double nopeus = 300; 12 const double hyppyNopeus = 800; 13 13 const int RUUDUN_KOKO = 40; 14 14 15 15 PlatformCharacter pelaaja1; 16 PlatformCharacter pelaaja2; 16 17 17 Image pelaajanKuva = LoadImage("norsu");18 18 19 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"); 21 23 22 24 public override void Begin() 23 25 { 24 Gravity = new Vector(0, - 900);26 Gravity = new Vector(0, -1400); 25 27 26 28 LuoKentta(); 27 29 LisaaNappaimet(); 28 30 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(); 32 35 } 33 36 … … 37 40 kentta.SetTileMethod('#', LisaaTaso); 38 41 kentta.SetTileMethod('*', LisaaTahti); 39 kentta.SetTileMethod('N', LisaaPelaaja); 42 kentta.SetTileMethod('1', LisaaPelaaja); 43 kentta.SetTileMethod('2', LisaaPelaaja2); 44 kentta.SetTileMethod('M', LisaaMaali); 40 45 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 41 Level.CreateBorders();42 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; 43 51 } 52 44 53 45 54 void LisaaTaso(Vector paikka, double leveys, double korkeus) … … 66 75 pelaaja1.Position = paikka; 67 76 pelaaja1.Mass = 4.0; 68 pelaaja1.Image = pelaajanKuva; 69 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 77 pelaaja1.Image = pelaajan1Kuva; 70 78 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; 71 93 } 72 94 … … 80 102 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 81 103 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 82 108 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 83 109 … … 85 111 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 86 112 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); 87 119 88 120 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); … … 99 131 } 100 132 101 void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 102 { 103 maaliAani.Play(); 104 MessageDisplay.Add("Keräsit tähden!"); 105 tahti.Destroy(); 106 } 133 107 134 } -
2015/26/PatrikL/Soccer/Soccer/Soccer/Soccer.csproj.Debug.cachefile
r6191 r6267 1 Content\maali.xnb2 1 Content\norsu.xnb 3 2 Content\tahti.xnb 4 3 Content\kentta1.xnb 4 Content\Tyyppi3.xnb 5 Content\Maali.xnb 6 Content\tyyppi2.xnb -
2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/ContentPipeline-{F106661A-C7EB-416D-A109-33F8C01CB95C}.xml
r6191 r6267 2 2 <XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 3 3 <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>13 4 <Item> 14 5 <Source>norsu.png</Source> … … 36 27 <Options>None</Options> 37 28 <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> 39 57 </Item> 40 58 <BuildSuccessful>true</BuildSuccessful> -
2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/Soccer.csproj.FileListAbsolute.txt
r6191 r6267 11 11 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\obj\x86\Debug\Soccer.exe 12 12 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\obj\x86\Debug\Soccer.pdb 13 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Tyyppi3.xnb 14 C:\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.xnb2 1 Content\norsu.xnb 3 2 Content\tahti.xnb 4 3 Content\kentta1.xnb 4 Content\Tyyppi3.xnb 5 Content\Maali.xnb 6 Content\tyyppi2.xnb -
2015/26/PatrikL/Soccer/Soccer/SoccerContent/SoccerContent.contentproj
r6191 r6267 46 46 </ItemGroup> 47 47 <ItemGroup> 48 <Compile Include="maali.wav">49 <Name>maali</Name>50 <Importer>WavImporter</Importer>51 <Processor>SoundEffectProcessor</Processor>52 </Compile>53 48 <Compile Include="norsu.png"> 54 49 <Name>norsu</Name> … … 67 62 </Compile> 68 63 </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> 69 85 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 70 86 <!-- 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 4 4 5 5 6 N6 1 M 2 7 7 ######################
Note: See TracChangeset
for help on using the changeset viewer.