Changeset 2818
- Timestamp:
- 2012-06-06 16:07:25 (11 years ago)
- Location:
- 2012/23/LeoS
- Files:
-
- 12 added
- 1 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/23/LeoS/leoS/leoS/leoS.cs
r2808 r2818 9 9 public class LeoS : PhysicsGame 10 10 { 11 12 11 13 PhysicsObject pelaaja; 12 14 bool pelaajaIlmassa = false; … … 16 18 public override void Begin() 17 19 { 18 MultiSelectWindow valikko = new MultiSelectWindow(" Tervetuloa peliin",19 " Aloita peli", "Lopeta"); valikko.ItemSelected += PainettiinValikonNappia;20 MultiSelectWindow valikko = new MultiSelectWindow("Päävalikko", 21 "Kenttä1", "Kenttä2", "Kenttä3", "kentta4", "Lopeta"); valikko.ItemSelected += PainettiinValikonNappia; 20 22 Add(valikko); 21 23 … … 25 27 26 28 27 void AloitaPeli() 28 { 29 LuoKentta(); 30 Level.BackgroundColor = Color.Yellow; 29 void AloitaPeli(string levelFile) 30 { 31 32 33 ClearAll(); 34 LataaKentta(levelFile); 35 36 37 Level.Background.CreateGradient(Color.Teal, Color.Ruby); 31 38 Gravity = new Vector(0, -400); 39 40 MediaPlayer.Play("Tausta"); 32 41 33 42 Surface alareuna = Surface.CreateBottom(Level); 34 43 alareuna.IsVisible = false; 35 alareuna.Tag = "reuna"; //Nämä Pois Begin-aliohjelmasta44 alareuna.Tag = "reuna"; 36 45 Add(alareuna); 37 46 … … 40 49 oikeareuna.Tag = "muuri"; 41 50 Add(oikeareuna); 51 AsetaOhjaimet(); 52 53 Camera.Follow(pelaaja); 54 42 55 } 43 56 … … 48 61 { 49 62 case 0: 50 AloitaPeli( );63 AloitaPeli("kentta1"); 51 64 break; 52 65 case 1: 66 AloitaPeli("kentta2"); 67 break; 68 case 2: 69 AloitaPeli("kentta3"); 70 break; 71 case 3: 72 AloitaPeli2("kentta4"); 73 break; 74 case 4: 53 75 Exit(); 54 76 break; … … 59 81 60 82 61 void LuoKentta() 62 { 63 LataaKentta("kentta1"); 64 AsetaOhjaimet(); 65 Camera.Follow(pelaaja); 83 void LuoKentta(string levelFile) 84 { 66 85 67 86 } … … 72 91 ruudut.SetTileMethod('P', LuoPelaaja); 73 92 ruudut.SetTileMethod('#', LuoPalikka); 93 ruudut.SetTileMethod('*', LuoEste); 94 ruudut.SetTileMethod('T', LuoTykki); 74 95 75 96 … … 87 108 AddCollisionHandler(pelaaja, "reuna", PelaajaOsuiReunaan); 88 109 AddCollisionHandler(pelaaja, "muuri", PelaajaOsuiMuuriin); 89 pelaaja.Restitution = 54.00; 110 AddCollisionHandler(pelaaja, "tahti", PelaajaOsuiTahtiin); 111 pelaaja.Restitution = 100.00; 90 112 Add(pelaaja); 91 113 } … … 99 121 Label tekstikentta = new Label("teksti"); 100 122 tekstikentta.Text = "Hävisit Pelin"; 101 tekstikentta.TextColor = Color.BlueGray; 102 Add(tekstikentta); 123 tekstikentta.TextColor = Color.Black; 124 Add(tekstikentta); 125 126 103 127 tekstikentta.Font = Font.DefaultLarge; 128 LuoAikaLaskuri(); 129 104 130 105 131 } … … 113 139 Add(taso); 114 140 } 141 142 void LuoEste(Vector paikka, double leveys, double korkeus) 143 { 144 PhysicsObject este = PhysicsObject.CreateStaticObject( 145 leveys, korkeus, Shape.Star); 146 este.Position = paikka; 147 este.Color = Color.DarkMagenta; 148 este.Tag = "tahti"; 149 Add(este); 150 } 115 151 void AsetaOhjaimet() 116 152 { … … 118 154 Keyboard.Listen(Key.Right, ButtonState.Pressed, Etene, "Pelaaja 1: hyppää", pelaaja); 119 155 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppy, "Pelaaja 1: Liiku", pelaaja); 120 156 Keyboard.Listen(Key.Down, ButtonState.Pressed, Hyppy2, "Hyppää alas", pelaaja); 121 157 122 158 } … … 127 163 pelaaja.Velocity = nopeus; 128 164 } 129 165 130 166 void Hyppy(PhysicsObject pelaaja) 131 167 { … … 137 173 void PelaajaOsuiMuuriin(PhysicsObject tormaaja, PhysicsObject kohde) 138 174 { 139 //140 175 Label tekstikentta = new Label("teksti"); 141 176 tekstikentta.Text = "Voitit Pelin"; … … 144 179 Add(tekstikentta); 145 180 tekstikentta.Font = Font.DefaultLargeBold; 146 } 147 //void AloitaUudelleen() 148 //{ 149 //MultiSelectWindow valikko2 = new MultiSelectWindow("Aloita Alusta", "Lopeta"); 150 //valikko2.ItemSelected += UudelleenAloitusValikko; 151 //Add(valikko2); 152 //AloitaPeli(); 153 154 // } 155 //void UudelleenAloitusValikko(int valinta) 156 //{ 157 // switch (valinta) 158 //{ 159 // case 0: 160 // AloitaUudelleen(); 161 // break; 162 //case 1: 163 // Exit(); 164 //break; 165 //} 166 //} 181 pelaaja.Destroy(); 182 LuoAikaLaskuri(); 183 } 184 void PelaajaOsuiTahtiin(PhysicsObject tormaaja, PhysicsObject kohde) 185 { 186 187 pelaaja.Destroy(); 188 Explosion rajahdys = new Explosion(600.0); 189 rajahdys.Position = pelaaja.Position; 190 Add(rajahdys); 191 Label tekstikentta = new Label("teksti"); 192 tekstikentta.Text = "Osuit Tähteen"; 193 tekstikentta.Color = Color.Yellow; 194 tekstikentta.TextColor = Color.Red; 195 tekstikentta.Font = Font.DefaultLargeBold; 196 Add(tekstikentta); 197 LuoAikaLaskuri(); 198 199 } 200 201 202 void LuoTykki(Vector paikka, double leveys, double korkeus) 203 { 204 Cannon ase = new Cannon(50, 10); 205 ase.Tag = "kanuuna"; 206 ase.Angle = Angle.FromDegrees(90); 207 ase.Power.DefaultValue = 9000; 208 ase.ProjectileCollision += AmmusOsuiPelaajaan; 209 ase.MaxAmmoLifetime = TimeSpan.FromSeconds(1.0); 210 ase.Position = paikka; 211 ase.AttackSound = null; 212 Add(ase); 213 Timer ampumisAjastin = new Timer(); 214 ampumisAjastin.Interval = 1.2; 215 ampumisAjastin.Start(); 216 ampumisAjastin.Timeout += delegate { ase.Shoot(); }; 217 218 } 219 220 void AmmusOsuiPelaajaan(PhysicsObject ammus, PhysicsObject kohde) 221 { 222 223 Label tekstikentta = new Label("teksti"); 224 tekstikentta.Text = "Cannon Destroyed You"; 225 tekstikentta.Color = Color.Yellow; 226 tekstikentta.TextColor = Color.Red; 227 tekstikentta.Font = Font.DefaultLargeBold; 228 tekstikentta.X = Screen.Left + 0; 229 tekstikentta.Y = Screen.Top + 300; 230 Add(tekstikentta); 231 kohde.Destroy(); 232 LuoAikaLaskuri(); 233 } 234 void AloitaPeli2(string levelFile) 235 { 236 237 238 LataaKentta(levelFile); 239 Level.Background.CreateGradient(Color.Teal, Color.Ruby); 240 Gravity = new Vector(0, 400); 241 242 MediaPlayer.Play("Tausta2"); 243 244 Surface yläreuna = Surface.CreateTop(Level); 245 yläreuna.IsVisible = false; 246 yläreuna.Tag = "reuna"; 247 Add(yläreuna); 248 249 Surface oikeareuna = Surface.CreateRight(Level); 250 oikeareuna.IsVisible = false; 251 oikeareuna.Tag = "muuri"; 252 Add(oikeareuna); 253 AsetaOhjaimet(); 254 Camera.Follow(pelaaja); 255 256 } 257 void Hyppy2(PhysicsObject pelaaja) 258 { 259 if (pelaajaIlmassa) return; 260 Vector nopeus = new Vector(0, -200); 261 pelaaja.Velocity = nopeus; 262 pelaajaIlmassa = true; 263 264 265 266 267 } 268 void LuoAikaLaskuri() 269 { 270 Timer aikaLaskuri = new Timer(); 271 aikaLaskuri.Interval = 3; 272 aikaLaskuri.Timeout += delegate { Begin(); }; 273 aikaLaskuri.Start(1); 274 167 275 } 168 169 170 171 276 } 277 278 279 280 281 282 -
2012/23/LeoS/leoS/leoS/leoS.csproj.Debug.cachefile
r2808 r2818 2 2 Content\kentta1.xnb 3 3 Content\kentta2.xnb 4 Content\kentta2.txt 4 Content\kentta3.xnb 5 Content\Tausta.xnb 6 Content\kentta4.xnb 7 Content\Tausta2.xnb 8 Content\Tausta.wma 9 Content\Tausta2.wma 10 Content\kentta1.txt -
2012/23/LeoS/leoS/leoS/obj/x86/Debug/cachefile-{25605763-3341-4275-93D9-4B0A394A16A7}-targetpath.txt
r2808 r2818 2 2 Content\kentta1.xnb 3 3 Content\kentta2.xnb 4 Content\kentta2.txt 4 Content\kentta3.xnb 5 Content\Tausta.xnb 6 Content\Tausta.wma 7 Content\kentta4.xnb 8 Content\Tausta2.xnb 9 Content\Tausta2.wma 10 Content\kentta1.txt -
2012/23/LeoS/leoS/leoS/obj/x86/Debug/leoS.csproj.FileListAbsolute.txt
r2808 r2818 26 26 J:\LeoS\LeoS\leoS\leoS\obj\x86\Debug\leoS.pdb 27 27 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta2.xnb 28 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta2.txt 28 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta.xnb 29 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta3.xnb 30 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta1.txt 31 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta.wma 32 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta4.xnb 33 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta2.xnb 34 J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta2.wma -
2012/23/LeoS/leoS/leoSContent/kentta1.txt
r2808 r2818 1 1 2 ### 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # 20 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # # 33 # # 34 # # 35 # 0 ####################### # 36 # # 37 # # 38 # # 39 # ########### # 40 # # # 41 # # # 42 # # # 43 # # 44 # # 45 # # 46 # # 47 # # 48 ############################## # #### ##### # # 49 # # # # ################# # 50 # ####### # # # # # # # 51 # # # # # 52 # # # # ### # 53 # # # # # # 54 # # # ### # # 55 # ########### # # 56 # # # # 57 # # # 58 # #### ### ## # # # # 59 # # # # # 60 # # # # # # 61 # # # # # 62 ###### # # # # # ################### # 63 # # ################################# ############# 64 # ######## # # 65 # # # # # 66 # # # # # 67 # # # # 68 # # ## # # # ########## # # # # # # # ## # # # # # # # 69 P # # ########## # # # # 70 ############ ###### ########## ##### 2 * # 3 * # 4 * # # # 5 * # # # 6 * # # * * * * * * * * * # 7 ########## * # # # 8 # * # # # 9 # * # # # # # # 10 ## # T # * # # # # # # 11 ### #### ## ### ###### ## ### # * * * * # 12 # # # # 13 # # # 14 # # # 15 # ####### ############ 16 ## ### # 17 # # # 18 # # # 19 # T # ####### 20 P #### #### #### # 21 ############ ######### -
2012/23/LeoS/leoS/leoSContent/kentta2.txt
r2808 r2818 1 1 2 # 3 # 4 # # # 5 # # # # 6 # # # 7 ########## # # # 8 # # # # 9 # # # # # # 10 # # # # # # # # # # # 11 ## # # # # # # # # # # # # # 12 ######### ####### ###### ####### # # # 13 # # # # # 14 # # # 15 # # # 16 # ####### ############ 17 ########## # 18 # # # 19 # # # 20 # # ####### 21 P #### #### #### # 22 ############..######### 2 ### 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # 20 # 21 # 22 # 23 # 24 # 25 # 26 # 27 # 28 # 29 # 30 # 31 # 32 # # 33 # # 34 # # 35 # ####################### # 36 # # 37 # # 38 # # 39 # ########### # 40 # # # 41 # # # 42 # # # 43 # # 44 # # 45 # # 46 # # 47 # # 48 ############################## # #### ##### # # 49 # # # # ################# # 50 # ####### # # # # # # # 51 # # # # # 52 # # # # ### # 53 # # # # # # 54 # # # ### # # 55 # ########### # # 56 # # # # 57 # # # 58 # #### ### ## # # # # 59 * # # # # # 60 * # # # # # # 61 * # T # # # # 62 ###### * # # # # # ################### # 63 * # # ################################# ############# 64 * # ######## # # 65 # # * # # T 66 # # ******* # # 67 # # # # 68 # # ## # # # ########## # # # # # # 69 P # # ########## T # # # 70 ############ ###### ########## ##### -
2012/23/LeoS/leoS/leoSContent/leoSContent.contentproj
r2808 r2818 52 52 </ItemGroup> 53 53 <ItemGroup> 54 <Compile Include="kentta1.txt"> 55 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 56 <Name>kentta1</Name> 57 <Importer>TextFileImporter</Importer> 58 <Processor>TextFileContentProcessor</Processor> 59 </Compile> 60 </ItemGroup> 61 <ItemGroup> 54 62 <Compile Include="kentta2.txt"> 55 <CopyToOutputDirectory>Always</CopyToOutputDirectory>56 63 <Name>kentta2</Name> 57 64 <Importer>TextFileImporter</Importer> … … 60 67 </ItemGroup> 61 68 <ItemGroup> 62 <Compile Include="kentta 1.txt">63 <Name>kentta 1</Name>69 <Compile Include="kentta3.txt"> 70 <Name>kentta3</Name> 64 71 <Importer>TextFileImporter</Importer> 65 72 <Processor>TextFileContentProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="Tausta.mp3"> 77 <Name>Tausta</Name> 78 <Importer>Mp3Importer</Importer> 79 <Processor>SongProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 83 <Compile Include="kentta4.txt"> 84 <Name>kentta4</Name> 85 <Importer>TextFileImporter</Importer> 86 <Processor>TextFileContentProcessor</Processor> 87 </Compile> 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="Tausta2.mp3"> 91 <Name>Tausta2</Name> 92 <Importer>Mp3Importer</Importer> 93 <Processor>SongProcessor</Processor> 66 94 </Compile> 67 95 </ItemGroup> -
2012/23/LeoS/leoS/leoSContent/obj/x86/Debug/ContentPipeline.xml
r2808 r2818 18 18 <Options>None</Options> 19 19 <Output>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta1.xnb</Output> 20 <Time>2012-06-0 5T19:41:23.844819+03:00</Time>20 <Time>2012-06-06T13:46:59.5806075+03:00</Time> 21 21 </Item> 22 22 <Item> … … 27 27 <Options>None</Options> 28 28 <Output>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta2.xnb</Output> 29 <Time>2012-06-05T14:22:43.5066507+03:00</Time> 29 <Time>2012-06-06T13:27:57.9201046+03:00</Time> 30 </Item> 31 <Item> 32 <Source>kentta3.txt</Source> 33 <Name>kentta3</Name> 34 <Importer>TextFileImporter</Importer> 35 <Processor>TextFileContentProcessor</Processor> 36 <Options>None</Options> 37 <Output>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta3.xnb</Output> 38 <Time>2012-06-06T15:09:30.4095428+03:00</Time> 39 </Item> 40 <Item> 41 <Source>Tausta.mp3</Source> 42 <Name>Tausta</Name> 43 <Importer>Mp3Importer</Importer> 44 <Processor>SongProcessor</Processor> 45 <Options>None</Options> 46 <Output>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta.xnb</Output> 47 <Extra>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta.wma</Extra> 48 <Time>2012-06-06T13:38:22.1266075+03:00</Time> 49 </Item> 50 <Item> 51 <Source>kentta4.txt</Source> 52 <Name>kentta4</Name> 53 <Importer>TextFileImporter</Importer> 54 <Processor>TextFileContentProcessor</Processor> 55 <Options>None</Options> 56 <Output>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\kentta4.xnb</Output> 57 <Time>2012-06-06T15:30:19.3156024+03:00</Time> 58 </Item> 59 <Item> 60 <Source>Tausta2.mp3</Source> 61 <Name>Tausta2</Name> 62 <Importer>Mp3Importer</Importer> 63 <Processor>SongProcessor</Processor> 64 <Options>None</Options> 65 <Output>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta2.xnb</Output> 66 <Extra>J:\LeoS\LeoS\leoS\leoS\bin\x86\Debug\Content\Tausta2.wma</Extra> 67 <Time>2012-06-06T14:56:16.5106058+03:00</Time> 30 68 </Item> 31 69 <BuildSuccessful>true</BuildSuccessful>
Note: See TracChangeset
for help on using the changeset viewer.