- Timestamp:
- 2015-07-24 11:36:05 (8 years ago)
- Location:
- 2015/30/ValtteriT/Labyrintti
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/Labyrintti.cs
r6998 r7018 9 9 public class Labyrintti : PhysicsGame 10 10 { 11 const double nopeus = 200;11 const double nopeus = 30000; 12 12 const double hyppyNopeus = 3000; 13 13 const int RUUDUN_KOKO = 40; … … 15 15 AssaultRifle pelaajan1Ase; 16 16 17 Image PlasmaPanos = LoadImage("PlasmaParticle"); 18 //Image LaserBeam = LoadImage("LaserBeam"); 17 19 Image tankinKuva = LoadImage("Tankki"); 18 20 19 21 PhysicsObject pelaaja1; 20 22 PhysicsObject CannonBall; 23 IntMeter Elamat; 24 25 int kenttaNro; 21 26 22 27 SoundEffect RajahdysAani = LoadSoundEffect("RajahdysAani"); … … 24 29 public override void Begin() 25 30 { 31 ClearAll(); 32 26 33 Gravity = new Vector(0, 0); 27 34 … … 33 40 Camera.StayInLevel = false; 34 41 } 42 43 void SeuraavaKentta() 44 { 45 ClearAll(); 46 47 if (kenttaNro == 1) LuoKentta("kentta1"); 48 else if (kenttaNro == 2) LuoKentta("kentta2"); 49 else if (kenttaNro == 3) LuoKentta("kentta3"); 50 else if (kenttaNro > 3) Exit(); 51 52 LisaaNappaimet(); 53 54 } 55 56 void LuoKentta(string kenttaTiedostonNimi) 57 { 58 TileMap ruudut = TileMap.FromLevelAsset(kenttaTiedostonNimi); 59 //tässä luodaan kenttä tekstitiedostosta 60 } 61 62 void TormasiMaaliin(PhysicsObject pelaaja, PhysicsObject maali) 63 { 64 //Kasvatetaan kenttänumeroa yhdellä ja siirrytään seuraavaan kenttään: 65 kenttaNro++; 66 SeuraavaKentta(); 67 } 68 69 35 70 36 71 void LuoKentta() … … 41 76 kentta.SetTileMethod('N', LisaaPelaaja); 42 77 kentta.SetTileMethod('4', LisaaMiina); 78 kentta.SetTileMethod('5', LisaaMaali); 43 79 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 44 80 Level.CreateBorders(); 45 81 Level.Background.Color = Color.White; 46 82 } 83 84 void LisaaMaali(Vector paikka, double leveys, double korkeus) 85 { 86 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 87 } 88 89 47 90 48 91 void LisaaTaso(Vector paikka, double leveys, double korkeus) … … 71 114 Miina.Tag = "Miina"; 72 115 Add (Miina); 116 117 AddCollisionHandler(Miina, "CannonBall", AmmuitMiinan); 73 118 } 74 119 … … 78 123 pelaaja1.Position = paikka; 79 124 pelaaja1.Restitution = 0.5; 80 pelaaja1.Mass = 0.5; 125 pelaaja1.Mass = 2.5; 126 pelaaja1.KineticFriction = 1; 127 pelaaja1.LinearDamping = 0.1; 81 128 pelaaja1.Image = tankinKuva; 82 129 pelaaja1.Tag = "tankki"; … … 85 132 Add(pelaaja1); 86 133 134 Elamat = new IntMeter(3, 0, 3); 135 Elamat.LowerLimit += delegate { pelaaja1.Destroy(); }; 136 ProgressBar elamaPalkki = new ProgressBar(150, 20); 137 elamaPalkki.X = Screen.Left + 150; 138 elamaPalkki.Y = Screen.Top - 20; 139 elamaPalkki.BindTo(Elamat); 140 Add(elamaPalkki); 87 141 88 142 pelaajan1Ase = new AssaultRifle(60, 10); 89 143 pelaajan1Ase.IsVisible = false; 90 //pelaajan1Ase.CanHitOwner = true; 91 pelaajan1Ase.FireRate = 20.0; 92 pelaajan1Ase.Power.DefaultValue = 200; 93 pelaajan1Ase.ProjectileCollision = AmmusOsui; 144 pelaajan1Ase.CanHitOwner = false; 145 pelaajan1Ase.FireRate = 10; 146 pelaajan1Ase.Power.DefaultValue = 150; 147 //pelaajan1Ase.ProjectileCollision = AmmusOsui; 148 pelaajan1Ase.Ammo.Value = 25; 94 149 pelaajan1Ase.X = 20.0; 95 150 //pelaajan1Ase.ProjectileCollision = CollisionHandler.DestroyTarget; 96 pelaajan1Ase.ProjectileCollision = AmmuitMiinan;151 //pelaajan1Ase.ProjectileCollision = AmmuitMiinan; 97 152 98 153 pelaaja1.Add(pelaajan1Ase); … … 109 164 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 110 165 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 111 112 Mouse.ListenMovement(0.1, Tahtaa, "Tahtaa aseella"); 166 Keyboard.Listen(Key.Enter, ButtonState.Pressed, Begin, "Aloita alusta"); 167 168 Mouse.ListenMovement(0.0, Tahtaa, "Tahtaa aseella"); 113 169 IsMouseVisible = true; 114 170 Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 171 Keyboard.Listen(Key.Space, ButtonState.Down, Liiku, "Liikkuu", pelaaja1); 115 172 116 173 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, new Vector (-nopeus, 0)); … … 119 176 Keyboard.Listen(Key.Down, ButtonState.Down, Liikuta, "Liikkuu taaksepäin", pelaaja1, new Vector(0, -nopeus)); 120 177 Keyboard.Listen(Key.Up, ButtonState.Up, Liikuta, "Ei liiku", pelaaja1, new Vector(0, 0)); 121 178 122 179 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 123 180 124 181 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, new Vector (-nopeus, 0)); 125 182 ControllerOne.Listen(Button.X, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, new Vector (nopeus, 0)); … … 129 186 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 130 187 } 188 void Liiku(PhysicsObject hahmo) 189 { 190 hahmo.Push(Vector.FromLengthAndAngle(nopeus, hahmo.Angle)); 191 } 192 131 193 132 194 void Liikuta(PhysicsObject hahmo, Vector nopeus) … … 149 211 rajahdys.Force = 65; 150 212 Add(rajahdys); 213 214 Elamat.Value--; 151 215 } 152 216 … … 175 239 if(CannonBall != null) 176 240 { 177 CannonBall.Size *= 2;178 //ammus.Image = ?179 CannonBall.MaximumLifetime = TimeSpan.FromSeconds( 5.0);241 CannonBall.Size *= 1.5; 242 CannonBall.Image = PlasmaPanos; 243 CannonBall.MaximumLifetime = TimeSpan.FromSeconds(2.5); 180 244 CannonBall.Restitution = 1.0; 245 CannonBall.Tag = "CannonBall"; 246 CannonBall.IgnoresExplosions = false; 247 CannonBall.IgnoresPhysicsLogics = true; 181 248 } 182 249 } -
2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/Labyrintti.csproj.Debug.cachefile
r6998 r7018 1 1 Content\maali.xnb 2 Content\RajahdysAani.xnb3 2 Content\norsu.xnb 4 3 Content\tahti.xnb 4 Content\kentta1.xnb 5 5 Content\Rajahde.xnb 6 6 Content\Miina.xnb 7 Content\RajahdysAani.xnb 7 8 Content\Tankki.xnb 8 Content\kentta1.xnb 9 Content\LaserBeam.xnb 10 Content\PlasmaParticle.xnb 11 Content\kentta2.xnb -
2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/obj/x86/Debug/Labyrintti.csproj.FileListAbsolute.txt
r6998 r7018 31 31 C:\MyTemp\ValtteriT\Labyrintti\Labyrintti\Labyrintti\obj\x86\Debug\Labyrintti.exe 32 32 C:\MyTemp\ValtteriT\Labyrintti\Labyrintti\Labyrintti\obj\x86\Debug\Labyrintti.pdb 33 C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\LaserBeam.xnb 34 C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\PlasmaParticle.xnb 35 C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\kentta2.xnb -
2015/30/ValtteriT/Labyrintti/Labyrintti/Labyrintti/obj/x86/Debug/cachefile-{15692C82-E01C-4162-86C3-61CF42C88FB4}-targetpath.txt
r6998 r7018 1 1 Content\maali.xnb 2 Content\RajahdysAani.xnb3 2 Content\norsu.xnb 4 3 Content\tahti.xnb 4 Content\kentta1.xnb 5 5 Content\Rajahde.xnb 6 6 Content\Miina.xnb 7 Content\RajahdysAani.xnb 7 8 Content\Tankki.xnb 8 Content\kentta1.xnb 9 Content\LaserBeam.xnb 10 Content\PlasmaParticle.xnb 11 Content\kentta2.xnb -
2015/30/ValtteriT/Labyrintti/Labyrintti/LabyrinttiContent/LabyrinttiContent.contentproj
r6993 r7018 95 95 </Compile> 96 96 </ItemGroup> 97 <ItemGroup> 98 <Compile Include="LaserBeam.png"> 99 <Name>LaserBeam</Name> 100 <Importer>TextureImporter</Importer> 101 <Processor>TextureProcessor</Processor> 102 </Compile> 103 </ItemGroup> 104 <ItemGroup> 105 <Compile Include="PlasmaParticle.png"> 106 <Name>PlasmaParticle</Name> 107 <Importer>TextureImporter</Importer> 108 <Processor>TextureProcessor</Processor> 109 </Compile> 110 </ItemGroup> 111 <ItemGroup> 112 <Compile Include="kentta2.txt"> 113 <Name>kentta2</Name> 114 <Importer>TextFileImporter</Importer> 115 <Processor>TextFileContentProcessor</Processor> 116 </Compile> 117 </ItemGroup> 97 118 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 98 119 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/30/ValtteriT/Labyrintti/Labyrintti/LabyrinttiContent/kentta1.txt
r6998 r7018 1 1 333333333333333333333333333333333333333333333 2 3 3 3 3 3 4 3 3 5 3 3 6 3 3 3 3 3 3 33333 3 3 337 3 3 3 3 3 3 3 3 3 3 338 3 3 3 3 3 3 3 33333 3 339 3 3 10 3 3 3 3 3 3 3 33 311 3 3 3 3 12 3 3 3 13 3 3 3 3 3 3 3 3 33 314 3 33 3 3 3 3 3 3 315 3 3 3 3 333333 3 3 3 316 3 17 3 33333 3 3 3 3 3 3 3 3318 3 34443 3 3 3 3 33 3 319 3 3 4 4 3 3 3 3 20 3 3 4 3 3 3 3 3 3 3321 3 3 4 3 3 3 3 3 3 3 3322 3 34443 3 3 3 3 3 3 3323 3 33333 3 3 3 33 3 3 324 3 3 3 3 3 3 3 3 3325 3 3 3 3 3 3 33 3 3 326 3 3 3 3 3 3 3 3 3327 3 3 3 3 3 3 33 328 3 3 4 3 3 3 3 3 3329 3 3 3 3 3 3 33 3 32 3 3 4 3 3 3 3 3 3 3 3 3 3 4 3 3 3 3 3 3 3 4 3 3 4 3 3 3 3 3 3 3 5 3 3 4 3 3 3 3 3 3 3 3 3 3 6 3 3 34 3 3 3 33333 3 3 3 7 3 3 3 3 3 3 3 3 3 3 444 3 8 3 34443 43 3 3 3 33333 3 3 9 3 34443 3 3 3 3 3 3 3 10 3 3 3 4 3 3 3 3 3 4 3 3 11 3 3 3 34443 3 3 33333 3 3 3 12 3 3 3 4 3 3 3 3 3 3 3 3 13 3 34 3 4 3 3 3 3 3 34 3 3 14 3 4 3 4 43 3 3 3 3 3 3 3 15 3 4 3 3 3 344433333 3 3 3 3 16 3 4 3 3 3 3 3 3 3 3 3 3 17 3 33333 434443 3 3 3 3 3 33333 18 3 34443 3 3 3 3 4 33333 3 3 19 3 3 4 4 3 3 3 3 4 3 3 3 3 20 3 3 4 3 3 43 3 4 3 44 3 21 3 4 3 4 3 3 3 3 43 3 4 3 22 3 34443 3 3 4 3 3 3 4 43 23 3 33333 3 3 4 3 3 43 3 3 3 24 3 34443 3 4 344 3 3 33333 4 3 25 3 34443 3 4 3 3 34 3 3 3 3 26 3 3 3 3 3 4 3 3 34 3 27 3 3 3 4 4 3 4 43 4 3 3 28 3 3 4 3 4 3 4 3 4 3 43 29 3 3 3 4 4 3 3 3 4 3 3 3 30 30 3 3333333333333333333333333333333333333 3 31 31 3 44444444444444444444444444444444444 3 32 3 44444444444444444444444444444444444 32 3 44444444444444444444444444444444444 5 3 33 33 3 N 44444444444444444444444444444444444 3 34 34 333333333333333333333333333333333333333333333 -
2015/30/ValtteriT/Labyrintti/Labyrintti/LabyrinttiContent/obj/x86/Debug/ContentPipeline.xml
r6993 r7018 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2015-07-2 3T11:00:09.3971539+03:00</Time>38 <Time>2015-07-24T11:33:22.4736975+03:00</Time> 39 39 </Item> 40 40 <Item> … … 73 73 <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\Tankki.xnb</Output> 74 74 <Time>2015-07-23T14:32:28.4159388+03:00</Time> 75 </Item> 76 <Item> 77 <Source>LaserBeam.png</Source> 78 <Name>LaserBeam</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\LaserBeam.xnb</Output> 83 <Time>2015-07-24T09:55:06.1242082+03:00</Time> 84 </Item> 85 <Item> 86 <Source>PlasmaParticle.png</Source> 87 <Name>PlasmaParticle</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\PlasmaParticle.xnb</Output> 92 <Time>2015-07-24T09:59:55.7947279+03:00</Time> 93 </Item> 94 <Item> 95 <Source>kentta2.txt</Source> 96 <Name>kentta2</Name> 97 <Importer>TextFileImporter</Importer> 98 <Processor>TextFileContentProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\Valtteri(Mikko)T\Labyrintti\Labyrintti\Labyrintti\bin\x86\Debug\Content\kentta2.xnb</Output> 101 <Time>2015-07-24T11:25:39.319988+03:00</Time> 75 102 </Item> 76 103 <BuildSuccessful>true</BuildSuccessful>
Note: See TracChangeset
for help on using the changeset viewer.