- Timestamp:
- 2015-07-23 11:50:21 (8 years ago)
- Location:
- 2015/30/EemilR
- Files:
-
- 96 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli.cs
r6939 r6974 27 27 Image Avaimeton2Kuva = LoadImage("Avaimeton2"); 28 28 Image Avain2Kuva = LoadImage("Avain2"); 29 Image pahiksenKuva = LoadImage("Vihollinen1"); 30 Image oviVasenKuva = LoadImage("OviVasen"); 31 Image paluuOikeaKuva = LoadImage("PaluuOikea"); 29 32 30 33 DoubleMeter avaintenmaara; … … 36 39 PhysicsObject viimeinenCheckpoint; 37 40 38 41 bool cheats = false; 42 43 bool painovoima = true; 44 45 39 46 40 47 … … 48 55 49 56 IsFullScreen = true; 50 51 Gravity = new Vector(0, -1000);52 57 53 58 LuoKentta(); … … 55 60 Asetamittari(); 56 61 AsetaLaskin(); 62 LisaaPainovoima(); 57 63 58 64 … … 62 68 63 69 70 71 } 72 73 void LisaaPainovoima() 74 { 75 if (painovoima == true) 76 { 77 Gravity = new Vector(0, -1000); 78 } 79 else 80 { 81 Gravity = new Vector(0, 0); 82 } 64 83 65 84 } … … 74 93 tekstikentta.Y = Screen.Top - 100; 75 94 tekstikentta.TextColor = Color.Black; 95 tekstikentta.Text = tekstikentta + "moimoi"; 76 96 Add(tekstikentta); 77 97 } … … 102 122 kentta.SetTileMethod('C', LisaaCheckpoint); 103 123 kentta.SetTileMethod('2', LisaaOvi2); 124 kentta.SetTileMethod('V', LisaaPahis); 125 kentta.SetTileMethod('<', LisaaVasenOvi); 126 127 128 kentta.SetTileMethod('U', LisaaOikeaPaluu); 129 104 130 kentta.Execute(Koko, Koko); 105 131 Level.CreateBorders(); … … 107 133 108 134 PhysicsObject liikkuva1 = new PhysicsObject(200.0, 40.0); 135 } 136 137 void LisaaOikeaPaluu(Vector paikka, double leveys, double korkeus) 138 { 139 PhysicsObject PaluuOikea = PhysicsObject.CreateStaticObject(leveys, korkeus); 140 PaluuOikea.Position = paikka; 141 PaluuOikea.Image = paluuOikeaKuva; 142 PaluuOikea.IgnoresCollisionResponse = true; 143 Add(PaluuOikea); 144 } 145 146 void LisaaVasenOvi(Vector paikka, double leveys, double korkeus) 147 { 148 PhysicsObject OviVasen = PhysicsObject.CreateStaticObject(leveys, korkeus); 149 OviVasen.Position = paikka; 150 OviVasen.Image = oviVasenKuva; 151 OviVasen.IgnoresCollisionResponse = true; 152 Add(OviVasen); 153 } 154 155 156 void LisaaPahis(Vector paikka, double leveys, double korkeus) 157 { 158 PlatformCharacter Pahis = new PlatformCharacter(leveys, korkeus); 159 Pahis.Position = paikka; 160 Pahis.Image = pahiksenKuva; 161 Pahis.Tag = "pahis"; 162 Pahis.Shape = Shape.FromImage(pahiksenKuva); 163 164 PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 165 tasoAivot.Speed = 100; 166 167 Pahis.Brain = tasoAivot; 168 Add(Pahis); 109 169 } 110 170 … … 169 229 AddCollisionHandler(pelaaja1, "piikki", osuiPiikkiin); 170 230 AddCollisionHandler(pelaaja1, "checkpoint", checkpointAktivoitu); 231 AddCollisionHandler(pelaaja1, "pahis", osuiPiikkiin); 171 232 pelaaja1.IgnoresCollisionResponse = false; 172 233 Add(pelaaja1); … … 184 245 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 185 246 Keyboard.Listen(Key.R, ButtonState.Pressed, ResetToCheckpoint , "Palaa edelliseen checkpointtiin"); 247 Keyboard.Listen(Key.Enter, ButtonState.Pressed, CheatitPaalle, "Enable Cheats"); 186 248 187 249 Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); … … 189 251 Keyboard.Listen(Key.Space, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 190 252 253 254 191 255 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 192 256 … … 196 260 197 261 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 262 } 263 264 void LiikuYlos(PlatformCharacter hahmo, double nopeus) 265 { 266 pelaaja1.Hit(new Vector(0, 1000)); 267 } 268 269 void LiikuAlas(PlatformCharacter hahmo, double nopeus) 270 { 271 pelaaja1.Hit(new Vector(0, -1000)); 272 } 273 274 void LiikuOikealle(PlatformCharacter hahmo, double nopeus) 275 { 276 pelaaja1.Hit(new Vector(4000, 0)); 277 } 278 279 void LiikuVasemmalle(PlatformCharacter hahmo, double nopeus) 280 { 281 pelaaja1.Hit(new Vector(-4000, 0)); 198 282 } 199 283 … … 233 317 } 234 318 235 void osuiPiikkiin(PhysicsObject pelaaja1, PhysicsObject avain)319 void osuiPiikkiin(PhysicsObject pelaaja1, PhysicsObject juttu) 236 320 { 237 321 pelaaja1.Position = viimeinenCheckpoint.Position; 238 322 239 323 kuolemat.Value += 1; 324 240 325 } 241 326 … … 258 343 ovi2.Destroy(); 259 344 } 345 else 346 { 347 MessageDisplay.Add("Sinulla ei ole tarpeeksi avaimia."); 348 } 260 349 } 261 350 262 351 void ovenAvaus(PhysicsObject pelaaja1, PhysicsObject ovi) 263 352 { 264 if(avaintenmaara > 0) 265 { 266 MessageDisplay.Add("Avasit oven"); 267 avaintenmaara.Value -= 1; 268 ovi.Destroy(); 269 } 270 271 } 272 273 353 if (avaintenmaara > 0) 354 { 355 MessageDisplay.Add("Avasit oven"); 356 avaintenmaara.Value -= 1; 357 ovi.Destroy(); 358 } 359 else 360 { 361 MessageDisplay.Add("Sinulla ei ole tarpeeksi avaimia."); 362 } 363 364 } 365 366 void CheatitPaalle() 367 { 368 InputWindow kysymysIkkuna = new InputWindow("Enter Code To Enable Cheats"); 369 kysymysIkkuna.TextEntered += ProcessInput; 370 Add( kysymysIkkuna ); 371 } 372 373 void ProcessInput(InputWindow ikkuna) 374 { 375 string vastaus = ikkuna.InputBox.Text; 376 if (vastaus == "1234") 377 { 378 if (cheats == true) 379 { 380 cheats = false; 381 painovoima = true; 382 pelaaja1.IgnoresCollisionResponse = false; 383 LisaaPainovoima(); 384 Keyboard.Disable(Key.O); 385 Keyboard.Disable(Key.K); 386 Keyboard.Disable(Key.L); 387 Keyboard.Disable(Key.J); 388 } 389 else 390 { 391 cheats = true; 392 painovoima = false; 393 pelaaja1.IgnoresCollisionResponse = true; 394 Keyboard.Enable(Key.O); 395 Keyboard.Enable(Key.K); 396 Keyboard.Enable(Key.L); 397 Keyboard.Enable(Key.J); 398 Keyboard.Listen(Key.I, ButtonState.Pressed, LiikuYlos, "Ylös", pelaaja1, nopeus); 399 Keyboard.Listen(Key.K, ButtonState.Pressed, LiikuAlas, "Alas", pelaaja1, nopeus); 400 Keyboard.Listen(Key.L, ButtonState.Pressed, LiikuOikealle, "Oikealle", pelaaja1, nopeus); 401 Keyboard.Listen(Key.J, ButtonState.Pressed, LiikuVasemmalle, "Vasemmalle", pelaaja1, nopeus); 402 LisaaPainovoima(); 403 404 405 } 406 } 407 } 274 408 275 409 void avaimetTaynna() -
2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli/Tasohyppelypeli.csproj.Debug.cachefile
r6939 r6974 14 14 Content\Avaimeton2.xnb 15 15 Content\Avain2.xnb 16 Content\Vihollinen1.xnb 17 Content\OviVasen.xnb 18 Content\PaluuOikea.xnb -
2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/TasohyppelypeliContent/TasohyppelypeliContent.contentproj
r6939 r6974 138 138 </Compile> 139 139 </ItemGroup> 140 <ItemGroup> 141 <Compile Include="Vihollinen1.png"> 142 <Name>Vihollinen1</Name> 143 <Importer>TextureImporter</Importer> 144 <Processor>TextureProcessor</Processor> 145 </Compile> 146 </ItemGroup> 147 <ItemGroup> 148 <Compile Include="OviVasen.png"> 149 <Name>OviVasen</Name> 150 <Importer>TextureImporter</Importer> 151 <Processor>TextureProcessor</Processor> 152 </Compile> 153 </ItemGroup> 154 <ItemGroup> 155 <Compile Include="PaluuOikea.png"> 156 <Name>PaluuOikea</Name> 157 <Importer>TextureImporter</Importer> 158 <Processor>TextureProcessor</Processor> 159 </Compile> 160 </ItemGroup> 140 161 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 141 162 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/30/EemilR/Tasohyppelypeli/Tasohyppelypeli/TasohyppelypeliContent/kentta1.txt
r6939 r6974 1 .............................................................................................................................................................................. 2 .............................................................................................................................................................................. 3 .............................................................................................................................................................................. 4 .............................................................................................................................................................................. 5 .............................................................................................................................................................................. 6 .............................................................................................................................................................................. 7 ...................################........................................................................................................................................................... 8 ...................#..............#########............................................................................................................................................. 9 ####################......................#..................................................................................................................................... 10 #..................#......................#............................................................................................................................. 11 #..................#.#.......#....#########............................................................................................................................................. 12 #..................#.#.#..........#............................................................................................................................................. 13 #..................###...........##............................................................................................................................................. 14 #.......#....##....#...........####............................................................................................................................................. 15 #.###..............#..#############..................................................................................................................................................... 16 #.#.#............###O#####....#####........................................................................................................................................................ 17 #A#.#..............#..............#............................................................................................................................................ 18 #.#.#........###...########.......#.................................................................................................................................................... 19 #.###...#..........#..........#...#................................................................................................................................................ 20 #...#..............#..............#.......................................................................................................................................... 21 #.N.########.......#..###########A#............................................................................................................................................... 22 #.C...........#........#........###................................................................................................................................................ 23 #........AAA.......##..2........#................................................................................................................................. 24 ######A#######################..#########.......................................................................................................................................................................... 25 .....#O#A....................#..........#...................................................................................................................................... 26 .....#.#................####.##...#.....#........................................................................................................................................ 27 .....#.############........#O#........#.#.................................................................................................................................................... 28 .....#.#...........#.......#C..##.....#A#.......................................................................................................................................... 29 .....#C#...................#.......#..###......................................................................................................................................... 30 .....#.................##..#..........#......................................................................................................................................... 31 .....#........PP..PP.......#.........##............................................................................................................................................ 32 .....#######################PPP..PPP.A#................................................................................................................................................................ 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 .............................................................................................................................................................................. 62 .............................................................................................................................................................................. 63 .............................................................................................................................................................................. 64 .............................................................................................................................................................................. 65 .............................................................................................................................................................................. 66 .............................................................................................................................................................................. 67 .............................................................................................................................................................................. 68 .............................................................................................................................................................................. 69 .............................................................................................................................................................................. 70 .............................................................................................................................................................................. 1 ..................................................................................................................................................................................... 2 ..................................................................................................................................................................................... 3 ..................................................................................................................................................................................... 4 ..................................................................................................................................................................................... 5 ..................................................................................................................................................................................... 6 ...................################.......##################.......................................................................................................................................... 7 ...................#..............#########................#......................................................................................................................... 8 ####################......................#..#############.#.......................................................................................................................... 9 #..................#......................#..............#.#.......................................................................................................................... 10 #..................#.#.......#....#######O#############..#C#.......................................................................................................................... 11 #..................#A#.#..........#..................2...#.########......................................................................................................................... 12 #..................###...........##.########.....#########.#......#.................................................................................................................... 13 #.......#....##....#...........####.......#.....C#....#....#.#....#..................................................................................................................... 14 #.###..............#..###################.#....##.....#..###.##...#...................................................................................................................... 15 #.#.#............###O#####....#####.....#A##..........#......#....#.................................................................................................................... 16 #A#.#..............#..............#....A###...........#....###...##...................................................................................................................... 17 #.#.#........###...########.......#.#..#..#...#.......#....###....#.................................................................................................................... 18 #.###...#..........#..........#...#.......#...........#PP..####...#.................................................................................................................... 19 #...#..............#..............##......#......#....#....###....#.................................................................................................................... 20 #.N.########.......#..###########A#.......#...........#....###...##.................................................................................................................... 21 #.C...........#....#...#........###...#.........V....##A...###....#.................................................................................................................... 22 #................V.##..2........###PPPP.###############....####...#.................................................................................................................... 23 ######.#######################..#######################..PP###....#.................................................................................................................... 24 .....#O#A....................#..........#.............#....###...##..................................................................................................................... 25 .....#.#................####.##...#.....#.............#....###....#.................................................................................................................. 26 ..#..#.############........#O#........#.#.............#....####...#........................................................................................................................ 27 ..#..#.#...........#.......#C..##.....#A#.............#PP..###....#..................................................................................................................... 28 ..#..#C#...................#.......#..###.............#....###...##..................................................................................................................... 29 ..#..#.................##..#..........###.............#....###....#..................................................................................................................... 30 ..#..#........PP..PP.......#.........##...............#....####...#..................................................................................................................... 31 ..#..#######################PPP..PPP.A#...............#..PP###....#..................................................................................................................... 32 ..#........................############...............#....###...##.............................................................................................................. 33 ..#...................................................#....###....#................................................................................................................... 34 ..################....................................#....####...#................................................................................................................... 35 ..#...................................................#PP..###....#................................................................................................................... 36 ..#...................................................#....###....#................................................................................................................... 37 ..#...................................................#....###...##............................................................................................................. 38 ..#...................................................#....###....#............................................................................................................. 39 ..#...................................................#..PP####...#............................................................................................................. 40 ..#...................................................#....###....#............................................................................................................................... 41 ..#...................................................#....###....#............................................................................................................................... 42 ..#...................................................#....###...##............................................................................................................................... 43 ..#...................................................#PP.A###....#............................................................................................................................... 44 ..#...................................................#....####...#............................................................................................................................... 45 ..#...................................................#....###....#............................................................................................................................... 46 ..#...................................................#....###....#............................................................................................................................... 47 ..#...................................................#..PP###...##............................................................................................................................... 48 ..#...................................................#....###....#............................................................................................................................... 49 ..#...................................................#....####...#............................................................................................................................... 50 ..#...................................................#....###....#............................................................................................................................... 51 ..#..........................................##########PP..###....#......................................................................................................................... 52 ..#..........................................#..............##...##.................................................................................................................... 53 ..#..........................................#..............##....#.................................................................................................................... 54 ..#..........................................#..............###...#........................................................................................................................ 55 ..#..........................................#..............##....#......................................................................................................................... 56 ..#..........................................#..............##...##......................................................................................................................... 57 ..#..........................................#..............##...##......................................................................................................................... 58 ..#..........................................#..................###......................................................................................................................... 59 ..#.........................................C2..........V.......###................................................................................................................... 60 ###################################################################................................................................................................................................. 61 ..................................................................................................................................................................................... 62 ..................................................................................................................................................................................... 63 ..................................................................................................................................................................................... 64 ..................................................................................................................................................................................... 65 ..................................................................................................................................................................................... 66 ..................................................................................................................................................................................... 67 ..................................................................................................................................................................................... 68 ..................................................................................................................................................................................... 69 .....................................................................................................................................................................................
Note: See TracChangeset
for help on using the changeset viewer.