- Timestamp:
- 2013-06-14 12:41:25 (10 years ago)
- Location:
- 2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely
- Files:
-
- 41 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely.cs
r4120 r4158 32 32 Image rajahdys = LoadImage("explosion0"); 33 33 Image liekkikuva = LoadImage("liekki"); 34 Image ammuskuva = LoadImage("ammus"); 34 35 SoundEffect hurt = LoadSoundEffect("hit"); 35 36 SoundEffect shoot = LoadSoundEffect("shoot"); 36 37 SoundEffect explosion = LoadSoundEffect("explosion"); 37 38 SoundEffect powerup = LoadSoundEffect("powerup"); 39 Flame liekki; 38 40 39 41 … … 46 48 47 49 bool SaaAmpua = true; 48 49 50 50 51 52 51 53 public override void Begin() 52 54 { … … 55 57 ClearAll(); 56 58 Level.Background.Image = tausta; 57 58 SetWindowSize(1920, 1080, true); 59 MultiSelectWindow valikko = new MultiSelectWindow("Generic Space Game", "Start Game", "How to play", "High Score", "Quit"); 59 //Level.Background.FitToLevel(); 60 61 SetWindowSize(1024, 768, true); 62 //SetWindowSize(1920, 1080, true); 63 64 65 66 67 MultiSelectWindow valikko = new MultiSelectWindow("Just some generic space game", "Start Game", "How to play", "High Score", "Quit"); 60 68 //valikko.ItemSelected += PainettiinValikonNappia; 61 62 valikko.Color = Color.SkyBlue; 63 69 70 valikko.Color = Color.DarkGray; 71 valikko.SelectionColor = Color.DarkJungleGreen; 72 valikko.BorderColor = Color.DarkJungleGreen; 73 valikko.SetButtonTextColor(Color.SkyBlue); 74 //valikko.te 75 64 76 valikko.BorderColor = Color.Black; 65 77 valikko.AddItemHandler(0, AloitaPeli); … … 67 79 valikko.AddItemHandler(2, ParhaatPisteet); 68 80 valikko.AddItemHandler(3, ConfirmExit); 69 81 70 82 Add(valikko); 71 83 72 84 } 73 85 … … 77 89 topLista.HighScoreWindow.Closed += delegate { Begin(); }; 78 90 } 79 91 80 92 void AloitaPeli() 81 93 { … … 103 115 ElamaNaytto.Title = "HP"; 104 116 ElamaNaytto.BindTo(ElamaLaskuri); 105 106 ElamaLaskuri.LowerLimit += 117 118 ElamaLaskuri.LowerLimit += ElamaLoppui; 107 119 ElamaLaskuri.LowerLimit += ElamaLaskuri.Reset; 108 120 //ElamaLaskuri.LowerLimit += topLista.EnterAndShow(pisteLaskuri.Value); … … 117 129 { 118 130 alus.Destroy(); 131 liekki.Destroy(); 132 119 133 explosion.Play(); 120 134 ControllerOne.Vibrate(10.0, 10.0, 10.0, 10.0, 1.5); … … 122 136 Explosion rajahdys = new Explosion(1000); 123 137 rajahdys.Position = alus.Position; 124 rajahdys.Force = 0;138 rajahdys.Force = 9001; 125 139 Add(rajahdys); 140 MediaPlayer.Stop(); 126 141 topLista.EnterAndShow(pisteLaskuri.Value); 127 142 topLista.HighScoreWindow.Closed += delegate { Begin(); }; 128 129 143 144 130 145 } 131 146 132 147 void Ohjeet() 133 148 { 134 MessageWindow ikkuna = new MessageWindow("The goal of this game is to survive. You get points when time passes and from destroying enemies. Health Packs give you 2 HP. \n \n \n Controls (Keyboard): \n \n WASD: move \n \n rCtrl: shoot \n \n Press Enterto continue \n");149 MessageWindow ikkuna = new MessageWindow("The goal of this game is to survive.\nYou get points when time passes and from destroying enemies.\nHealth Packs give you 2 HP.\n\n\nControls (Keyboard): \n \n WASD: move \n \n rCtrl: shoot \n \n Controls (Controller): \n \n Left Analog Stick: move \n \n Left Trigger: shoot \n \n Press Enter or A to continue \n"); 135 150 ikkuna.Closed += delegate { Begin(); }; 136 151 ikkuna.Message.SizeMode = TextSizeMode.AutoSize; … … 163 178 //pisteNaytto.Color = Color.White; 164 179 pisteNaytto.Title = "Points"; 165 180 166 181 167 182 pisteNaytto.BindTo(pisteLaskuri); 168 183 Add(pisteNaytto); 169 184 170 185 } 171 186 … … 173 188 void LuoKentta() 174 189 { 175 Level.Width = Screen.Width; 176 Level.Height = Screen.Height; 190 if (1920 == Window.ClientBounds.Width) 191 { 192 Level.Width = Screen.Width; 193 Level.Height = Screen.Height; 194 } 195 else 196 { 197 Level.Width = Screen.Width*1.5; 198 Level.Height = Screen.Height*1.5; 199 200 } 177 201 Level.CreateBorders(); 178 202 203 204 Camera.ZoomToLevel(); 205 Camera.StayInLevel = true; 206 207 179 208 alus = new alus(100, 100); 180 209 alus.Shape = Shape.Rectangle; 181 210 alus.X = 0; 211 182 212 alus.Y = 0; 183 213 alus.Image = aluskuva; … … 185 215 alus.LinearDamping = 0.95; 186 216 alus.ElamaLaskuri.Value--; 187 Vector pelaajanSuunta = Vector.FromLengthAndAngle(2500.0, alus.Angle); 188 Flame liekki = new Flame(liekkikuva); 189 //liekki.RotateImage = true; 190 //liekki. = Angle.RightAngle; 217 218 liekki = new Flame(liekkikuva); 219 liekki.Position = alus.Position; 220 liekki.MinVelocity = 200; 221 liekki.MaxVelocity = 200; 222 liekki.MinAcceleration = 200; 223 liekki.MaxAcceleration = 200; 224 liekki.MinLifetime = 0.1; 225 liekki.MaxLifetime = 0.11; 191 226 liekki.IgnoreWind = false; 192 Wind = new Vector(0, -100); 227 228 193 229 Add(liekki, -1); 194 230 195 231 Level.Background.Image = tausta; 232 Level.Background.FitToLevel(); 196 233 197 234 Add(alus); 198 235 236 //Level.AmbientLight = 0.2; 237 //Light valo = new Light(); 238 //valo.Intensity = 0.8; 239 //valo.Distance = 150; 240 //valo.Position = alus.Position; 241 //Add(valo); 242 199 243 AddCollisionHandler(alus, "vihollinen", kuolema); 244 200 245 AddCollisionHandler(alus, "hp", LisaaTerveys); 201 246 } 202 247 203 248 204 249 205 250 void AsetaOhjaimet() … … 215 260 ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, KaannaTatilla, null); 216 261 ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); 217 ControllerOne.Listen(Button.Start, ButtonState.Pressed, Pause , null);262 ControllerOne.Listen(Button.Start, ButtonState.Pressed, Pausetus, null); 218 263 ControllerOne.ListenAnalog(AnalogControl.LeftTrigger, 0.1, AmmuLiipasin, null); 219 264 265 266 267 268 } 269 270 void Pausetus() 271 { 272 Pause(); 220 273 221 222 274 275 276 } 277 278 protected override void Update(Time time) 279 { 280 if (liekki != null && alus != null) 281 { 282 Vector pelaajanSuunta = Vector.FromLengthAndAngle(2500.0, alus.Angle + Angle.StraightAngle); 283 liekki.Position = alus.AbsolutePosition + pelaajanSuunta.Normalize() * 50; 284 Wind = pelaajanSuunta; 285 } 286 287 base.Update(time); 223 288 } 224 289 … … 313 378 Add(asteroidi); 314 379 Angle asteroidikulma = (Vector.Zero - asteroidi.Position).Angle; 315 Vector asteroidivector = Vector.FromLengthAndAngle(500, RandomGen.NextAngle(asteroidikulma - Angle.FromDegrees(50), (asteroidikulma +Angle.FromDegrees(50))));380 Vector asteroidivector = Vector.FromLengthAndAngle(500, RandomGen.NextAngle(asteroidikulma - Angle.FromDegrees(50), (asteroidikulma + Angle.FromDegrees(50)))); 316 381 asteroidi.Hit(asteroidivector); 317 382 } … … 349 414 pelaajan1Ase.IsVisible = false; 350 415 pelaajan1Ase.FireRate = 9001; 351 pelaajan1Ase.InfiniteAmmo = true; 352 pelaajan1Ase.Power.DefaultValue = 100; 353 pelaajan1Ase.Power.Value = 100; 416 //pelaajan1Ase.InfiniteAmmo = true; 417 pelaajan1Ase.Ammo.Value = 3; 418 pelaajan1Ase.Power.DefaultValue = 150; 419 pelaajan1Ase.Power.Value = 150; 354 420 pelaajan1Ase.ProjectileCollision = AmmusOsui; 355 421 vihollinen.Add(pelaajan1Ase); … … 358 424 Angle vihollinenkulma = (Vector.Zero - vihollinen.Position).Angle; 359 425 Vector vihollinenvector = Vector.FromLengthAndAngle(500, RandomGen.NextAngle(vihollinenkulma - Angle.FromDegrees(10), (vihollinenkulma + Angle.FromDegrees(10)))); 360 426 361 427 vihollinen.Hit(vihollinenvector); 362 428 363 429 Timer ajastin = new Timer(); 364 ajastin.Interval = 5;430 ajastin.Interval = 2; 365 431 ajastin.Timeout += delegate { VihollinenAmpuu(vihollinen, pelaajan1Ase, ajastin); }; 366 432 ajastin.Start(); … … 379 445 rajahdys.Force = 0; 380 446 Add(rajahdys); 381 447 382 448 } 383 449 … … 408 474 SaaAmpua = false; 409 475 shoot.Play(); 410 PhysicsObject ammus = new PhysicsObject(10 , 10);476 PhysicsObject ammus = new PhysicsObject(100, 10); 411 477 412 478 Vector pelaajanSuunta = Vector.FromLengthAndAngle(2500.0, alus.Angle); … … 414 480 415 481 ammus.Position = alus.Position + Vector.FromLengthAndAngle(80.0, alus.Angle); 416 ammus.Shape = Shape. Circle;482 ammus.Shape = Shape.Rectangle; 417 483 ammus.Color = Color.Yellow; 484 ammus.Image = ammuskuva; 485 ammus.Angle = alus.AbsoluteAngle; 418 486 ammus.Hit(pelaajanSuunta); 419 487 … … 430 498 poistumisAjastin.Start(); 431 499 432 Timer.SingleShot(0. 002,500 Timer.SingleShot(0.2, 433 501 delegate { SaaAmpua = true; } 434 502 ); … … 460 528 461 529 pisteLaskuri.Value += 10; 462 530 463 531 } 464 532 -
2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely.csproj
r4075 r4158 19 19 <ApplicationIcon>Game.ico</ApplicationIcon> 20 20 <Thumbnail>GameThumbnail.png</Thumbnail> 21 <IsWebBootstrapper>false</IsWebBootstrapper> 22 <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath> 21 23 <PublishUrl>publish\</PublishUrl> 22 24 <Install>true</Install> … … 29 31 <UpdateRequired>false</UpdateRequired> 30 32 <MapFileExtensions>true</MapFileExtensions> 31 <ApplicationRevision> 0</ApplicationRevision>33 <ApplicationRevision>1</ApplicationRevision> 32 34 <ApplicationVersion>1.0.0.%2a</ApplicationVersion> 33 <IsWebBootstrapper>false</IsWebBootstrapper>34 35 <UseApplicationTrust>false</UseApplicationTrust> 36 <PublishWizardCompleted>true</PublishWizardCompleted> 35 37 <BootstrapperEnabled>true</BootstrapperEnabled> 36 <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath>37 38 </PropertyGroup> 38 39 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> … … 60 61 <PlatformTarget>x86</PlatformTarget> 61 62 <XnaCompressContent>true</XnaCompressContent> 63 </PropertyGroup> 64 <PropertyGroup> 65 <ManifestCertificateThumbprint>A30257ECFD09FAA6DDCE9A6663A7C3ADF1A4833E</ManifestCertificateThumbprint> 66 </PropertyGroup> 67 <PropertyGroup> 68 <ManifestKeyFile>GeneerinenAvaruuslentely_TemporaryKey.pfx</ManifestKeyFile> 69 </PropertyGroup> 70 <PropertyGroup> 71 <GenerateManifests>true</GenerateManifests> 72 </PropertyGroup> 73 <PropertyGroup> 74 <SignManifests>true</SignManifests> 62 75 </PropertyGroup> 63 76 <ItemGroup> … … 152 165 </BootstrapperPackage> 153 166 </ItemGroup> 167 <ItemGroup> 168 <None Include="GeneerinenAvaruuslentely_TemporaryKey.pfx" /> 169 </ItemGroup> 154 170 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 155 171 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> -
2013/24/AamosR/GeneerinenAvaruuslentely/GeneerinenAvaruuslentely/GeneerinenAvaruuslentelyContent/GeneerinenAvaruuslentelyContent.contentproj
r4120 r4158 129 129 </Compile> 130 130 </ItemGroup> 131 <ItemGroup> 132 <Compile Include="ammus.png"> 133 <Name>ammus</Name> 134 <Importer>TextureImporter</Importer> 135 <Processor>TextureProcessor</Processor> 136 </Compile> 137 </ItemGroup> 131 138 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 132 139 <!-- 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.