Changeset 4376
- Timestamp:
- 2013-07-02 15:10:32 (10 years ago)
- Location:
- 2013/27/Emil-AleksiK
- Files:
-
- 16 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/27/Emil-AleksiK/Pong/Pong/Pong/Pong.cs
r4341 r4376 11 11 PhysicsObject pallo; 12 12 PhysicsObject maila; 13 Image laatikkokuva = LoadImage("laatikko"); 13 14 public override void Begin() 14 15 { 16 Level.Width *= 1.4; 15 17 starttaa(); 16 18 aloita(); 17 18 19 19 20 20 21 21 22 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); … … 34 35 void liikuta(Vector suunta) 35 36 { 36 if (maila.Right > Level.Right )37 if (maila.Right > Level.Right && suunta.X >0) 37 38 { 38 39 maila.Velocity = Vector.Zero; 39 40 return; 40 41 } 41 if (maila.Left < Level.Left )42 if (maila.Left < Level.Left && suunta.X < 0) 42 43 { 43 44 maila.Velocity = Vector.Zero; … … 49 50 void starttaa() 50 51 { 51 pallo = new PhysicsObject(90.0, 90.0); 52 53 54 TileMap kentta = TileMap.FromLevelAsset("kentta1"); 55 kentta.SetTileMethod('o', luo_laatikko); 56 kentta.SetTileMethod('k', luo_pallo); 57 kentta.SetTileMethod('p', luo_maila); 58 kentta.Execute(40,40); 59 60 Level.CreateBorders(0.9, false); 61 pallo.Restitution = 1.5; 62 Level.BackgroundColor = Color.Green; 63 Camera.ZoomToLevel(); 64 IsMouseVisible = true; 65 66 67 } 68 69 void luo_laatikko(Vector paikka, double leveys, double korkeus) 70 { 71 PhysicsObject laatikko= PhysicsObject.CreateStaticObject(leveys, korkeus); 72 laatikko.Position = paikka; 73 laatikko.Image = laatikkokuva; 74 laatikko.Tag = "laatikko"; 75 Add(laatikko); 76 } 77 78 void luo_pallo(Vector paikka, double leveys, double korkeus) 79 { 80 pallo = new PhysicsObject(leveys, korkeus); 52 81 Add(pallo); 53 82 pallo.Shape = Shape.Circle; 54 83 pallo.Color = Color.Red; 55 pallo.X = -200; 56 pallo.Y = 42; 57 58 Level.CreateBorders(1.0, false); 59 pallo.Restitution = 1.0; 60 Level.BackgroundColor = Color.Green; 61 Camera.ZoomToLevel(); 62 IsMouseVisible = true; 63 maila = PhysicsObject.CreateStaticObject(250.0, 50.0); 84 pallo.Position = paikka; 85 AddCollisionHandler(pallo, "laatikko", törmäys); 86 } 87 void luo_maila(Vector paikka, double leveys, double korkeus) 88 { 89 maila = PhysicsObject.CreateStaticObject(leveys*3, korkeus); 64 90 maila.Shape = Shape.Rectangle; 65 maila.X = 0.0; 66 maila.Y = -350.0; 67 maila.Restitution = 1.0; 91 maila.Position = paikka; 92 maila.Restitution = 3.0; 68 93 Add(maila); 94 } 95 96 void törmäys(PhysicsObject pallo,PhysicsObject laatikko) 97 { 98 Explosion rajahdys = new Explosion(100); 99 rajahdys.Position = laatikko.Position; 100 rajahdys.UseShockWave = false; 101 Add(rajahdys); 102 laatikko.Destroy(); 69 103 70 104 } 105 71 106 } 107 -
2013/27/Emil-AleksiK/Pong/Pong/PongContent/PongContent.contentproj
r4341 r4376 45 45 <Reference Include="AnimationExtension" /> 46 46 </ItemGroup> 47 <ItemGroup> 48 <Compile Include="kentta1.txt"> 49 <Name>kentta1</Name> 50 <Importer>TextFileImporter</Importer> 51 <Processor>TextFileContentProcessor</Processor> 52 </Compile> 53 </ItemGroup> 54 <ItemGroup> 55 <Compile Include="laatikko.jpg"> 56 <Name>laatikko</Name> 57 <Importer>TextureImporter</Importer> 58 <Processor>TextureProcessor</Processor> 59 </Compile> 60 </ItemGroup> 47 61 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 48 62 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.