- Timestamp:
- 2015-06-26 11:31:12 (8 years ago)
- Location:
- 2015/26/PatrikL/Soccer
- Files:
-
- 8 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/PatrikL/Soccer/Soccer/Soccer/Soccer.cs
r6267 r6447 21 21 Image pelaajan2Kuva = LoadImage("tyyppi2"); 22 22 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 23 30 24 31 public override void Begin() 25 32 { 33 34 ClearAll(); 26 35 Gravity = new Vector(0, -1400); 27 36 28 37 LuoKentta(); 29 38 LisaaNappaimet(); 39 30 40 31 41 //Camera.Follow(pelaaja1, pelaaja2); … … 39 49 TileMap kentta = TileMap.FromLevelAsset("kentta1"); 40 50 kentta.SetTileMethod('#', LisaaTaso); 41 kentta.SetTileMethod('*', Lisaa Tahti);51 kentta.SetTileMethod('*', LisaaMaali); 42 52 kentta.SetTileMethod('1', LisaaPelaaja); 43 53 kentta.SetTileMethod('2', LisaaPelaaja2); 44 54 kentta.SetTileMethod('M', LisaaMaali); 55 kentta.SetTileMethod('p', LisaaPallo); 56 kentta.SetTileMethod('m', LisaaMaali2); 45 57 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; 51 59 } 52 60 … … 60 68 } 61 69 62 void Lisaa Tahti(Vector paikka, double leveys, double korkeus)70 void LisaaMaali(Vector paikka, double leveys, double korkeus) 63 71 { 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); 70 113 } 71 114 … … 76 119 pelaaja1.Mass = 4.0; 77 120 pelaaja1.Image = pelaajan1Kuva; 121 pelaaja1.Shape = Shape.FromImage(pelaajan1Kuva); 78 122 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); 81 126 } 82 void LisaaMaali();83 127 84 128 void LisaaPelaaja2(Vector paikka, double leveys, double korkeus) … … 88 132 pelaaja2.Mass = 4.0; 89 133 pelaaja2.Image = pelaajan2Kuva; 134 pelaaja2.Shape = Shape.FromImage(pelaajan2Kuva); 90 135 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); 93 139 } 94 140 … … 130 176 hahmo.Jump(nopeus); 131 177 } 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 } 132 191 133 192 -
2015/26/PatrikL/Soccer/Soccer/Soccer/Soccer.csproj.Debug.cachefile
r6267 r6447 5 5 Content\Maali.xnb 6 6 Content\tyyppi2.xnb 7 Content\pallo.xnb 8 Content\mario.xnb 9 Content\tausta.xnb 10 Content\mario.wma -
2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/ContentPipeline-{F106661A-C7EB-416D-A109-33F8C01CB95C}.xml
r6267 r6447 27 27 <Options>None</Options> 28 28 <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\kentta1.xnb</Output> 29 <Time>2015-06-2 4T14:28:40.5150977+03:00</Time>29 <Time>2015-06-26T10:10:42.5939222+03:00</Time> 30 30 </Item> 31 31 <Item> … … 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Tyyppi3.xnb</Output> 38 <Time>2015-06-2 4T13:23:50.9591977+03:00</Time>38 <Time>2015-06-25T10:00:47.1951477+03:00</Time> 39 39 </Item> 40 40 <Item> … … 45 45 <Options>None</Options> 46 46 <Output>C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Maali.xnb</Output> 47 <Time>2015-06-2 4T13:27:21.9921977+03:00</Time>47 <Time>2015-06-25T10:03:29.9831477+03:00</Time> 48 48 </Item> 49 49 <Item> … … 54 54 <Options>None</Options> 55 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> 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> 57 85 </Item> 58 86 <BuildSuccessful>true</BuildSuccessful> -
2015/26/PatrikL/Soccer/Soccer/Soccer/obj/x86/Debug/Soccer.csproj.FileListAbsolute.txt
r6267 r6447 13 13 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\Tyyppi3.xnb 14 14 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\tyyppi2.xnb 15 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\pallo.xnb 16 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\mario.xnb 17 C:\MyTemp\PatrikL\Soccer\Soccer\Soccer\bin\x86\Debug\Content\mario.wma 18 C:\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 5 5 Content\Maali.xnb 6 6 Content\tyyppi2.xnb 7 Content\pallo.xnb 8 Content\mario.xnb 9 Content\mario.wma 10 Content\tausta.xnb -
2015/26/PatrikL/Soccer/Soccer/SoccerContent/SoccerContent.contentproj
r6267 r6447 83 83 </Compile> 84 84 </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> 85 106 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 86 107 <!-- 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.