- Timestamp:
- 2013-07-02 15:02:23 (10 years ago)
- Location:
- 2013/27/LeeviN
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/27/LeeviN/joku random/joku random.sln
r4348 r4372 4 4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "joku random", "joku random\joku random\joku random.csproj", "{FE3C4184-D26A-420B-9404-2EE2CD931C4F}" 5 5 EndProject 6 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "joku randomContent", "joku random\joku randomContent\joku randomContent.contentproj", "{6F70D56E-376D-448C-9E97-26FB0505401F}" 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "joku randomContent", "joku random\joku randomContent\joku randomContent.contentproj", "{6F70D56E-376D-448C-9E97-26FB0505401F}" 7 EndProject 8 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{637339B6-8307-4750-96E1-3B9367E84F65}" 7 9 EndProject 8 10 Global -
2013/27/LeeviN/joku random/joku random/joku random/joku_random.cs
r4348 r4372 9 9 public class joku_random : PhysicsGame 10 10 { 11 12 PhysicsObject pallo1; 13 PhysicsObject pallo2; 14 11 15 public override void Begin() 12 16 { 13 PhysicsObject pallo = new PhysicsObject(40.0, 40.0); 14 pallo.Shape = Shape.Circle; 15 pallo.X = -100.0; 16 pallo.Y = 0.0; 17 pallo.LinearDamping = 0.890; 18 Add(pallo); 19 Keyboard.Listen(Key.W, ButtonState.Down, Kiihdyta, "Kiihdytä ylöspäin", pallo, new Vector(0, 4000)); 20 Keyboard.Listen(Key.S, ButtonState.Down, Kiihdyta, "Kiihdytä alaspäin", pallo, new Vector(0, -4000)); 21 Keyboard.Listen(Key.A, ButtonState.Down, Kiihdyta, "Kiihdytä ylöspäin", pallo, new Vector(-4000,0 )); 22 Keyboard.Listen(Key.D, ButtonState.Down, Kiihdyta, "Kiihdytä alaspäin", pallo, new Vector(4000, 0)); 17 SetWindowSize(1024, 768, false); 23 18 24 L evel.CreateBorders();19 LuoKentta(); 25 20 21 Keyboard.Listen(Key.Up, ButtonState.Down, Kiihdyta, "Kiihdytä ylöspäin", pallo2, new Vector(0, 4000)); 22 Keyboard.Listen(Key.Down, ButtonState.Down, Kiihdyta, "Kiihdytä alaspäin", pallo2, new Vector(0, -4000)); 23 Keyboard.Listen(Key.Left, ButtonState.Down, Kiihdyta, "Kiihdytä ylöspäin", pallo2, new Vector(-4000, 0)); 24 Keyboard.Listen(Key.Right, ButtonState.Down, Kiihdyta, "Kiihdytä alaspäin", pallo2, new Vector(4000, 0)); 25 26 Keyboard.Listen(Key.W, ButtonState.Down, Kiihdyta, "Kiihdytä ylöspäin", pallo1, new Vector(0, 4000)); 27 Keyboard.Listen(Key.S, ButtonState.Down, Kiihdyta, "Kiihdytä alaspäin", pallo1, new Vector(0, -4000)); 28 Keyboard.Listen(Key.A, ButtonState.Down, Kiihdyta, "Kiihdytä ylöspäin", pallo1, new Vector(-4000, 0)); 29 Keyboard.Listen(Key.D, ButtonState.Down, Kiihdyta, "Kiihdytä alaspäin", pallo1, new Vector(4000, 0)); 30 31 32 Level.CreateBorders(1.0, false); 33 Camera.ZoomToLevel(); 34 //Level.Background.Image = LoadImage("tausta"); 26 35 27 36 … … 37 46 } 38 47 48 void LuoKentta() 49 { 50 //1. Luetaan kuva uuteen ColorTileMappiin, kuvan nimen perässä ei .png-päätettä. 51 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("kentta1"); 52 53 //2. Kerrotaan mitä aliohjelmaa kutsutaan, kun tietyn värinen pikseli tulee vastaan kuvatiedostossa. 54 ruudut.SetTileMethod(Color.Red, LuoKolmio); 55 ruudut.SetTileMethod(Color.Black, LuoPelaaja1); 56 ruudut.SetTileMethod(Color.White, LuoPelaaja2); 57 58 //3. Execute luo kentän 59 // Parametreina leveys ja korkeus 60 ruudut.Execute(20, 20); 61 } 62 63 void LuoPelaaja1(Vector paikka, double leveys, double korkeus) 64 { 65 pallo1 = new PhysicsObject(leveys, korkeus); 66 pallo1.Shape = Shape.Circle; 67 pallo1.Color = Color.Red; 68 pallo1.Position = paikka; 69 pallo1.LinearDamping = 0.890; 70 Add(pallo1); 71 } 72 73 void LuoPelaaja2(Vector paikka, double leveys, double korkeus) 74 { 75 pallo2 = new PhysicsObject(leveys, korkeus); 76 pallo2.Shape = Shape.Circle; 77 pallo2.Color = Color.Green; 78 pallo2.Position = paikka; 79 pallo2.LinearDamping = 0.890; 80 Add(pallo2); 81 } 82 83 void LuoKolmio(Vector paikka, double leveys, double korkeus) 84 { 85 PhysicsObject kolmio = PhysicsObject.CreateStaticObject(leveys, korkeus, Shape.Triangle); 86 kolmio.Position = paikka; 87 kolmio.Color = Color.Gray; 88 //taso.Image = groundImage; 89 kolmio.CollisionIgnoreGroup = 1; 90 Add(kolmio); 91 } 39 92 } -
2013/27/LeeviN/joku random/joku random/joku randomContent/joku randomContent.contentproj
r4348 r4372 45 45 <Reference Include="AnimationExtension" /> 46 46 </ItemGroup> 47 <ItemGroup> 48 <Compile Include="tausta.jpg"> 49 <Name>tausta</Name> 50 <Importer>TextureImporter</Importer> 51 <Processor>TextureProcessor</Processor> 52 </Compile> 53 </ItemGroup> 54 <ItemGroup> 55 <Compile Include="kentta1.png"> 56 <Name>kentta1</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.