- Timestamp:
- 2016-07-07 15:08:32 (7 years ago)
- Location:
- 2015/koodauskerho/SanteriK
- Files:
-
- 7 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/FastestGunInTown.cs
r7902 r7973 8 8 9 9 public class FastestGunInTown : PhysicsGame 10 10 11 { 12 13 Image hahmonkuva = LoadImage("hahmo"); 14 Image hahmon2kuva = LoadImage("hahmo2"); 15 Image ammuskuva = LoadImage("ammus"); 16 17 PlatformCharacter[] pelaajat = new PlatformCharacter[2]; 11 18 public override void Begin() 12 19 { 13 // TODO: Kirjoita ohjelmakoodisi tähän20 LuoKentta(); 14 21 15 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");22 asetaohjaimet(); 16 23 17 PhysicsObject hahmo = new PhysicsObject(40, 20); 18 // kissa.Shape = Shape.Rectangle; 19 Add(hahmo); 24 25 } 26 void LuoKentta() 27 { 28 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("PelinKentta"); 29 ruudut.SetTileMethod(Color.FromHexCode("#FF4CFF00"), LuoPelaaja, 1); 30 ruudut.SetTileMethod(Color.Red, LuoPelaaja, 0); 31 ruudut.SetTileMethod(Color.Black, LuoTaso); 32 ruudut.Execute(40, 40); 20 33 21 34 } 22 35 36 void LuoTaso(Vector paikka, double korkeus, double leveys) 37 { 38 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 39 taso.Position = paikka; 40 Add(taso); 41 taso.Color = Color.Black; 42 } 43 44 void LuoPelaaja(Vector paikka, double korkeus, double leveys, int indeksi) 45 { 46 PlatformCharacter hahmo = new PlatformCharacter(200, 200); 47 hahmo.Shape = Shape.Rectangle; 48 Add(hahmo); 49 hahmo.Image = hahmonkuva; 50 hahmo.Position = paikka; 51 if(indeksi == 1) hahmo.Turn(Direction.Left); 52 53 AssaultRifle pelaajan1Ase = new AssaultRifle(30, 10); 54 pelaajan1Ase.Ammo.Value = 6; 55 pelaajan1Ase.ProjectileCollision = AmmusOsui; 56 hahmo.Weapon = pelaajan1Ase; 57 pelaajat[indeksi] = hahmo; 58 } 59 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 60 { 61 //ammus.Destroy(); 62 } 63 void AmmuAseella(AssaultRifle ase) 64 { 65 PhysicsObject ammus = ase.Shoot(); 66 67 if (ammus != null) 68 { 69 70 ammus.Size *= 3; 71 ammus.Image = ammuskuva; 72 ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 73 } 74 } 75 void asetaohjaimet() 76 { 77 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", (AssaultRifle)pelaajat[0].Weapon); 78 Keyboard.Listen(Key.LeftShift, ButtonState.Down, AmmuAseella, "Ammu", (AssaultRifle)pelaajat[1].Weapon); 79 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 80 } 81 23 82 } 24 83 -
2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/FastestGunInTown.csproj.Debug.cachefile
r7902 r7973 2 2 Content\revolveri.xnb 3 3 Content\ammus.xnb 4 Content\PelinKentta.xnb 5 Content\hahmo2.xnb -
2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/obj/x86/Debug/ContentPipeline-{1322E6E4-46B9-4B14-9148-224F2875B658}.xml
r7902 r7973 28 28 <Output>C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\ammus.xnb</Output> 29 29 <Time>2016-07-06T13:05:47.5204062+03:00</Time> 30 </Item> 31 <Item> 32 <Source>PelinKentta.png</Source> 33 <Name>PelinKentta</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\PelinKentta.xnb</Output> 38 <Time>2016-07-07T11:10:56.811584+03:00</Time> 39 </Item> 40 <Item> 41 <Source>hahmo2.png</Source> 42 <Name>hahmo2</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\hahmo2.xnb</Output> 47 <Time>2016-07-07T13:02:37.6155974+03:00</Time> 30 48 </Item> 31 49 <BuildSuccessful>true</BuildSuccessful> -
2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/obj/x86/Debug/FastestGunInTown.csproj.FileListAbsolute.txt
r7902 r7973 10 10 C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\revolveri.xnb 11 11 C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\ammus.xnb 12 C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\PelinKentta.xnb 13 C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\hahmo2.xnb -
2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/obj/x86/Debug/cachefile-{1322E6E4-46B9-4B14-9148-224F2875B658}-targetpath.txt
r7902 r7973 2 2 Content\revolveri.xnb 3 3 Content\ammus.xnb 4 Content\PelinKentta.xnb 5 Content\hahmo2.xnb -
2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTownContent/FastestGunInTownContent.contentproj
r7902 r7973 66 66 </Compile> 67 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="PelinKentta.png"> 70 <Name>PelinKentta</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="hahmo2.png"> 77 <Name>hahmo2</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 68 82 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 69 83 <!-- 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.