- Timestamp:
- 2016-06-14 14:55:34 (7 years ago)
- Location:
- 2016/24/EemeliN/Test
- Files:
-
- 23 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/24/EemeliN/Test/Test.sln
r7252 r7292 6 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test\Test.csproj", "{3AB4C1F6-012A-49E7-A6B9-3AFB0590882D}" 7 7 EndProject 8 Project("{ 96E2B04D-8817-42C6-938A-82C39BA4D311}") = "TestContent", "Test\TestContent\TestContent.contentproj", "{C4CAFCB8-EF75-4B1C-85B1-17BBB278D09E}"8 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestContent", "Test\TestContent\TestContent.contentproj", "{C4CAFCB8-EF75-4B1C-85B1-17BBB278D09E}" 9 9 EndProject 10 10 Global -
2016/24/EemeliN/Test/Test/Test/Test.cs
r7252 r7292 9 9 public class Test : PhysicsGame 10 10 { 11 PlatformCharacter Pelaaja1; 12 PlatformCharacter Pelaaja2; 13 14 private Image[] Animaatio = LoadImages("Abina", "Abinaa"); 15 private Image[] Animaatio2 = LoadImages("Pelaaja2", "Pelaaja2a"); 16 11 17 public override void Begin() 12 18 { 13 19 LuoKenttä(); 20 21 Gravity = new Vector(0, -500); 22 23 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, Pelaaja1, -100.0); 24 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, Pelaaja1, 100.0); 25 Keyboard.Listen(Key.Up, ButtonState.Down, Hyppää, null, Pelaaja1, 250.0); 26 27 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, Pelaaja2, -100.0); 28 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, Pelaaja2, 100.0); 29 Keyboard.Listen(Key.W, ButtonState.Down, Hyppää, null, Pelaaja2, 250.0); 30 31 Level.CreateBorders(); 32 SmoothTextures = true; 33 34 Pelaaja1.Restitution = 1.0; 35 Pelaaja1.Restitution = 1.0; 36 37 GameObject tausta = new GameObject(Level.Width, Level.Height); 38 tausta.Image = LoadImage("Tausta"); 39 Add(tausta, -3); 40 14 41 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 15 42 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 16 43 17 //Camera.Follow(); 44 Camera.Follow(Pelaaja1, Pelaaja2); 45 Camera.StayInLevel = true; 46 Camera.FollowXMargin = 600; 47 Camera.FollowYMargin = 200; 18 48 } 19 49 20 50 void LuoKenttä() 21 51 { 22 23 52 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Kenttä"); 24 53 ruudut.SetTileMethod(Color.Red, LuoPelaaja); 25 54 ruudut.SetTileMethod(Color.Black, LuoTaso); 55 ruudut.SetTileMethod(Color.Blue, LuoLiekki); 56 ruudut.SetTileMethod(Color.White, LuoValo); 26 57 ruudut.Execute(40, 40); 27 58 } … … 29 60 void LuoPelaaja(Vector paikka, double leveys, double korkeus) 30 61 { 31 32 PhysicsObject Pelaaja1 = new PhysicsObject(leveys, korkeus); 62 Pelaaja1 = new PlatformCharacter(leveys * 0.9, korkeus * 0.9); 33 63 34 64 Pelaaja1.Position = paikka; … … 39 69 Pelaaja1.Image = olionKuva; 40 70 41 P hysicsObject Pelaaja2 = new PhysicsObject(leveys, korkeus);71 Pelaaja2 = new PlatformCharacter(leveys * 0.9, korkeus * 0.9); 42 72 Add(Pelaaja2); 43 73 Pelaaja2.Position = paikka; … … 45 75 Pelaaja2.Image = LoadImage("pelaaja2"); 46 76 77 Pelaaja1.AnimWalk = new Animation(Animaatio); 78 Pelaaja1.AnimIdle = new Animation(Animaatio[0]); 47 79 48 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, 49 LiikutaPelaajaa, null, new Vector(-1000, 0), Pelaaja1); 50 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, 51 LiikutaPelaajaa, null, new Vector(1000, 0), Pelaaja1); 52 ControllerOne.Listen(Button.DPadUp, ButtonState.Down, 53 LiikutaPelaajaa, null, new Vector(0, 1000), Pelaaja1); 54 ControllerOne.Listen(Button.DPadDown, ButtonState.Down, 55 LiikutaPelaajaa, null, new Vector(0, -1000), Pelaaja1); 80 Pelaaja2.AnimWalk = new Animation(Animaatio2) { FPS = 5 }; 81 Pelaaja2.AnimIdle = new Animation(Animaatio2[0]); 56 82 57 ControllerTwo.Listen(Button.DPadLeft, ButtonState.Down, 58 LiikutaPelaajaa, null, new Vector(-1000, 0), Pelaaja2); 59 ControllerTwo.Listen(Button.DPadRight, ButtonState.Down, 60 LiikutaPelaajaa, null, new Vector(1000, 0), Pelaaja2); 61 ControllerTwo.Listen(Button.DPadUp, ButtonState.Down, 62 LiikutaPelaajaa, null, new Vector(0, 1000), Pelaaja2); 63 ControllerTwo.Listen(Button.DPadDown, ButtonState.Down, 64 LiikutaPelaajaa, null, new Vector(0, -1000), Pelaaja2); 83 Pelaaja1.Animation = new Animation(Animaatio); 84 Pelaaja2.Animation = new Animation(Animaatio2); 85 86 Pelaaja1.CollisionIgnoreGroup = 100; 87 Pelaaja2.CollisionIgnoreGroup = 100; 88 89 } 65 90 66 91 67 //camera68 Camera.Follow(Pelaaja1, Pelaaja2);69 70 Camera.StayInLevel = true;71 }72 92 73 93 void LuoTaso(Vector paikka, double leveys, double korkeus) … … 76 96 taso.Position = paikka; 77 97 taso.CollisionIgnoreGroup = 1; 98 taso.Image = LoadImage("Maa"); 78 99 Add(taso); 79 }80 81 82 void LiikutaPelaajaa(Vector vektori, PhysicsObject pelaaja)83 {84 pelaaja.Push(vektori);85 100 86 101 } 87 102 103 104 void LiikutaPelaajaa(PlatformCharacter pelaaja, double nopeus) 105 { 106 pelaaja.Walk(nopeus); 107 108 } 109 110 void Hyppää(PlatformCharacter pelaaja, double nopeus) 111 { 112 pelaaja.Jump(nopeus); 113 114 } 115 116 117 void LuoLiekki(Vector paikka, double leveys, double korkeus) 118 { 119 Flame liekki = new Flame(LoadImage("Flame")); 120 liekki.Position = paikka; 121 liekki.MaxLifetime = 3; 122 liekki.MaxScale = 100; 123 Add(liekki); 124 125 //int pMaxMaara = 50; 126 127 128 } 129 130 void LuoValo(Vector paikka, double leveys, double korkeus) 131 { 132 133 Level.AmbientLight = 0.8; 134 135 // Light valo = new Light(); 136 // valo.Intensity = 0.8; 137 // valo.Distance = 150; 138 // valo.Position = paikka; 139 // Add(valo); 140 } 141 142 void TaustaMusiikki() 143 { 144 MediaPlayer.PlayFromURL("https://www.youtube.com/watch?v=_rJMbTvUt6w"); 145 MediaPlayer.IsRepeating = true; 146 } 88 147 } 89 148 -
2016/24/EemeliN/Test/Test/Test/Test.csproj.Debug.cachefile
r7252 r7292 2 2 Content\KenttÀ.xnb 3 3 Content\pelaaja2.xnb 4 Content\Maa.xnb 5 Content\Tausta.xnb 6 Content\Abinaa.xnb 7 Content\pelaaja2a.xnb 8 Content\Flame.xnb -
2016/24/EemeliN/Test/Test/Test/obj/x86/Debug/ContentPipeline-{C4CAFCB8-EF75-4B1C-85B1-17BBB278D09E}.xml
r7252 r7292 18 18 <Options>None</Options> 19 19 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Kenttä.xnb</Output> 20 <Time>2016-06-1 3T14:54:19.5051144+03:00</Time>20 <Time>2016-06-14T14:29:52.1450703+03:00</Time> 21 21 </Item> 22 22 <Item> … … 28 28 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\pelaaja2.xnb</Output> 29 29 <Time>2016-06-13T14:10:37.1825604+03:00</Time> 30 </Item> 31 <Item> 32 <Source>Maa.png</Source> 33 <Name>Maa</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Maa.xnb</Output> 38 <Time>2016-06-14T09:46:36.7246171+03:00</Time> 39 </Item> 40 <Item> 41 <Source>Tausta.png</Source> 42 <Name>Tausta</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Tausta.xnb</Output> 47 <Time>2016-06-14T10:22:10.2695759+03:00</Time> 48 </Item> 49 <Item> 50 <Source>Abinaa.png</Source> 51 <Name>Abinaa</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Abinaa.xnb</Output> 56 <Time>2016-06-14T11:41:20.367469+03:00</Time> 57 </Item> 58 <Item> 59 <Source>pelaaja2a.png</Source> 60 <Name>pelaaja2a</Name> 61 <Importer>TextureImporter</Importer> 62 <Processor>TextureProcessor</Processor> 63 <Options>None</Options> 64 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\pelaaja2a.xnb</Output> 65 <Time>2016-06-14T11:47:11.8168294+03:00</Time> 66 </Item> 67 <Item> 68 <Source>Flame.png</Source> 69 <Name>Flame</Name> 70 <Importer>TextureImporter</Importer> 71 <Processor>TextureProcessor</Processor> 72 <Options>None</Options> 73 <Output>C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Flame.xnb</Output> 74 <Time>2016-06-14T13:51:38.5495536+03:00</Time> 30 75 </Item> 31 76 <BuildSuccessful>true</BuildSuccessful> -
2016/24/EemeliN/Test/Test/Test/obj/x86/Debug/Test.csproj.FileListAbsolute.txt
r7252 r7292 10 10 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\KenttÀ.xnb 11 11 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\pelaaja2.xnb 12 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Maa.xnb 13 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Tausta.xnb 14 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Abinaa.xnb 15 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\pelaaja2a.xnb 16 C:\MyTemp\EemeliN\Test\Test\Test\bin\x86\Debug\Content\Flame.xnb -
2016/24/EemeliN/Test/Test/Test/obj/x86/Debug/cachefile-{C4CAFCB8-EF75-4B1C-85B1-17BBB278D09E}-targetpath.txt
r7252 r7292 2 2 Content\KenttÀ.xnb 3 3 Content\pelaaja2.xnb 4 Content\Maa.xnb 5 Content\Tausta.xnb 6 Content\Abinaa.xnb 7 Content\pelaaja2a.xnb 8 Content\Flame.xnb -
2016/24/EemeliN/Test/Test/TestContent/TestContent.contentproj
r7252 r7292 60 60 </ItemGroup> 61 61 <ItemGroup> 62 <Compile Include="Maa.png"> 63 <Name>Maa</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="Tausta.png"> 70 <Name>Tausta</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="Abinaa.png"> 77 <Name>Abinaa</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 83 <Compile Include="pelaaja2a.png"> 84 <Name>pelaaja2a</Name> 85 <Importer>TextureImporter</Importer> 86 <Processor>TextureProcessor</Processor> 87 </Compile> 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="Flame.png"> 91 <Name>Flame</Name> 92 <Importer>TextureImporter</Importer> 93 <Processor>TextureProcessor</Processor> 94 </Compile> 95 </ItemGroup> 96 <ItemGroup> 62 97 <Compile Include="Kenttä.png"> 63 98 <Name>Kenttä</Name>
Note: See TracChangeset
for help on using the changeset viewer.