- Timestamp:
- 2016-06-22 15:53:42 (7 years ago)
- Location:
- 2016/25/SaanaR/Tasohyppelypeli1
- Files:
-
- 6 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.cs
r7479 r7487 12 12 const double hyppyNopeus = 850; 13 13 const int RUUDUN_KOKO = 40; 14 14 PhysicsObject teleportUlos; 15 15 PlatformCharacter pelaaja1; 16 16 int kolikoidenMaara = 0; 17 string[] kentat = new string[] { "kentta1", "kentta2", "kentta3" };18 int kenttaMenossa = 0;17 string[] kentat = new string[] { "kentta1", "kentta2", "kentta3", "kentta4", "kentta5" }; 18 int kenttaMenossa = 4; 19 19 Image pelaajanKuva = LoadImage("kärpänen"); 20 Image tahtiKuva = LoadImage("Piste");20 Image kolikkoKuva = LoadImage("Piste"); 21 21 Image AmpiaisenKuva = LoadImage("Ampiainen"); 22 22 … … 50 50 void LisaaAse (Vector paikka, double leveys, double korkeus) 51 51 { 52 PhysicsObject ase = new PhysicsObject(leveys, korkeus );52 PhysicsObject ase = new PhysicsObject(leveys, korkeus/3); 53 53 ase.Position = paikka; 54 54 ase.Tag = "ase"; 55 ase.Image = LoadImage("ase"); 55 56 Add(ase); 56 57 } … … 58 59 { 59 60 TileMap kentta = TileMap.FromLevelAsset(kentat[kenttaMenossa]); 60 kentta.SetTileMethod('#', LisaaTaso );61 kentta.SetTileMethod('*', Lisaa Tahti);61 kentta.SetTileMethod('#', LisaaTaso, "taso"); 62 kentta.SetTileMethod('*', LisaaKolikko); 62 63 kentta.SetTileMethod('A', LisaaAmpiainen); 63 64 kentta.SetTileMethod('N', LisaaPelaaja); 64 65 kentta.SetTileMethod('-', LisaaAse); 66 kentta.SetTileMethod('T', LisaaTaso, "Teleport"); 67 kentta.SetTileMethod('U', LisaaTaso, "TeleportUlos"); 65 68 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 66 69 Level.CreateBorders(); … … 79 82 aivot.Loop = true; 80 83 } 81 void LisaaTaso(Vector paikka, double leveys, double korkeus )84 void LisaaTaso(Vector paikka, double leveys, double korkeus, string tyyppi) 82 85 { 83 86 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 87 taso.IgnoresExplosions = true; 84 88 taso.Position = paikka; 85 89 taso.Shape = Shape.FromImage(pilvenreunat); 86 90 taso.Image = pilvenreunat; 87 91 taso.Color = Color.White; 92 taso.Tag = tyyppi; 93 Add(taso); 94 if (tyyppi.Equals("TeleportUlos")) teleportUlos = taso; 88 95 89 90 Add(taso); 91 } 92 93 void LisaaTahti(Vector paikka, double leveys, double korkeus) 94 { 95 PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys, korkeus); 96 tahti.IgnoresCollisionResponse = true; 97 tahti.Position = paikka; 98 tahti.Image = tahtiKuva; 99 tahti.Tag = "Piste"; 96 } 97 98 void LisaaKolikko(Vector paikka, double leveys, double korkeus) 99 { 100 PhysicsObject kolikko = PhysicsObject.CreateStaticObject(leveys, korkeus); 101 kolikko.IgnoresCollisionResponse = true; 102 kolikko.IgnoresExplosions = true; 103 kolikko.Position = paikka; 104 kolikko.Image = kolikkoKuva; 105 kolikko.Tag = "Piste"; 100 106 kolikoidenMaara++; 101 Add( tahti);107 Add(kolikko); 102 108 } 103 109 … … 108 114 pelaaja1.Mass = 4.0; 109 115 pelaaja1.Image = pelaajanKuva; 110 AddCollisionHandler(pelaaja1, "Piste", Tormaa Tahteen);116 AddCollisionHandler(pelaaja1, "Piste", TormaaKolikkoon); 111 117 AddCollisionHandler(pelaaja1, "ampiainen", TörmääAmpiaiseen); 112 118 AddCollisionHandler(pelaaja1, "ase", OtaAse); 119 AddCollisionHandler(pelaaja1, "Teleport", SiirraPelaajaa); 113 120 114 121 Add(pelaaja1); 122 } 123 void SiirraPelaajaa (PhysicsObject pelaaja, PhysicsObject teleport) 124 { 125 pelaaja1.Position = teleportUlos.Position; 126 pelaaja1.X += pelaaja.Height; 127 pelaaja1.Velocity = Vector.Zero; 115 128 } 116 129 void OtaAse (PhysicsObject pelaaja, PhysicsObject ase) … … 123 136 { 124 137 ammus.Destroy(); 138 Explosion ammusRajahdys = new Explosion(100); 139 ammusRajahdys.Position = kohde.Position; 140 Add(ammusRajahdys); 141 ammusRajahdys.Speed = 170.0; 142 ammusRajahdys.Force = 5; 125 143 if (kohde.Tag.Equals("ampiainen")) kohde.Destroy(); 144 126 145 } 127 146 void TörmääAmpiaiseen (PhysicsObject pelaaja, PhysicsObject ampiainen) … … 165 184 if (ammus != null) 166 185 { 186 ammus.IgnoresExplosions = true; 167 187 //ammus.Size *= 3; 168 188 //ammus.Image = ... … … 177 197 } 178 198 179 void Tormaa Tahteen(PhysicsObject hahmo, PhysicsObject tahti)199 void TormaaKolikkoon(PhysicsObject hahmo, PhysicsObject tahti) 180 200 { 181 201 maaliAani.Play(); -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1.csproj.Debug.cachefile
r7479 r7487 12 12 Content\hyppy.xnb 13 13 Content\kentta3.xnb 14 Content\kentta4.xnb 15 Content\kentta5.xnb 16 Content\ase.xnb -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r7479 r7487 36 36 <Options>None</Options> 37 37 <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2016-06-2 1T14:13:34.4026624+03:00</Time>38 <Time>2016-06-22T14:16:54.5596282+03:00</Time> 39 39 </Item> 40 40 <Item> … … 99 99 <Options>None</Options> 100 100 <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta2.xnb</Output> 101 <Time>2016-06-2 1T15:38:14.2282009+03:00</Time>101 <Time>2016-06-22T14:40:50.8741176+03:00</Time> 102 102 </Item> 103 103 <Item> … … 117 117 <Options>None</Options> 118 118 <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta3.xnb</Output> 119 <Time>2016-06-21T15:47:19.5383937+03:00</Time> 119 <Time>2016-06-22T15:25:25.1223315+03:00</Time> 120 </Item> 121 <Item> 122 <Source>kentta4.txt</Source> 123 <Name>kentta4</Name> 124 <Importer>TextFileImporter</Importer> 125 <Processor>TextFileContentProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta4.xnb</Output> 128 <Time>2016-06-22T15:21:40.5782184+03:00</Time> 129 </Item> 130 <Item> 131 <Source>kentta5.txt</Source> 132 <Name>kentta5</Name> 133 <Importer>TextFileImporter</Importer> 134 <Processor>TextFileContentProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta5.xnb</Output> 137 <Time>2016-06-22T14:40:50.8585246+03:00</Time> 138 </Item> 139 <Item> 140 <Source>ase.png</Source> 141 <Name>ase</Name> 142 <Importer>TextureImporter</Importer> 143 <Processor>TextureProcessor</Processor> 144 <Options>None</Options> 145 <Output>C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ase.xnb</Output> 146 <Time>2016-06-22T15:32:44.421579+03:00</Time> 120 147 </Item> 121 148 <BuildSuccessful>true</BuildSuccessful> -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/Tasohyppelypeli1.csproj.FileListAbsolute.txt
r7479 r7487 20 20 C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\hyppy.xnb 21 21 C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta3.xnb 22 C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta4.xnb 23 C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\kentta5.xnb 24 C:\Users\ohjelmointi\Documents\SaanaR\Tasohyppelypeli1\Tasohyppelypeli1\Tasohyppelypeli1\bin\x86\Debug\Content\ase.xnb -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r7479 r7487 12 12 Content\hyppy.xnb 13 13 Content\kentta3.xnb 14 Content\kentta4.xnb 15 Content\kentta5.xnb 16 Content\ase.xnb -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/Tasohyppelypeli1Content.contentproj
r7479 r7487 130 130 </Compile> 131 131 </ItemGroup> 132 <ItemGroup> 133 <Compile Include="kentta4.txt"> 134 <Name>kentta4</Name> 135 <Importer>TextFileImporter</Importer> 136 <Processor>TextFileContentProcessor</Processor> 137 </Compile> 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="kentta5.txt"> 141 <Name>kentta5</Name> 142 <Importer>TextFileImporter</Importer> 143 <Processor>TextFileContentProcessor</Processor> 144 </Compile> 145 </ItemGroup> 146 <ItemGroup> 147 <Compile Include="ase.png"> 148 <Name>ase</Name> 149 <Importer>TextureImporter</Importer> 150 <Processor>TextureProcessor</Processor> 151 </Compile> 152 </ItemGroup> 132 153 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 133 154 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta1.txt
r7479 r7487 3 3 4 4 * 5 # * *** A**5 # ***** ** A** 6 6 ##### #### ##### 7 7 … … 15 15 ## ## ## ## # 16 16 17 * * * **A *17 * * * *** *A * 18 18 ### ### ### ### ### 19 19 20 * * 20 * * * * *N* * * A 21 21 ########################### -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta2.txt
r7479 r7487 18 18 19 19 N * * * A 20 ####################### 20 ######################## -
2016/25/SaanaR/Tasohyppelypeli1/Tasohyppelypeli1/Tasohyppelypeli1Content/kentta3.txt
r7479 r7487 1 1 ########################################## 2 # ******** 3 # ******** 4 # ******** 2 # ************ AAAAAAAAAAAAAAAAAA # 3 # ************ AAAAAAAAAAAAAAAAAA # 4 # ************ AAAAAAAAAAAAAAAAAA # 5 5 ##################################### # 6 6 # 7 ** * * * AA*A **AA A *A* AA#7 ** * * * A*A **AA A *A* AA# 8 8 #### ### ### ### #### ### ### 9 9 10 ** * * AA* A *A A* AA10 ** * * A* A *A A* AA 11 11 ### ### ## ### ## ## # 12 12 13 ** * * * A A **A A A*13 **** * * * A A **A A A* 14 14 #### ### ### ## # ### # ## 15 15 A 16 ** 16 ** ** * A* *A A * A * 17 17 ### ## ## ## #### ### # 18 18 … … 20 20 ## ### ### ## ## ## ## ## 21 21 22 N * - * 23 ############################################## 22 N * - ******** A A A* A AA*A A *A A *AAAA 23 ###############################################
Note: See TracChangeset
for help on using the changeset viewer.