- Timestamp:
- 2014-07-23 01:03:01 (9 years ago)
- Location:
- 2014/30/MikkoL
- Files:
-
- 5 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/MikkoL/Gradiant/LM2/LM2/Gradiant.cs
r5553 r5556 106 106 Image bullet_player05 = LoadImage("bullet_player05"); 107 107 Image bullet_droid = LoadImage("bullet_droid"); 108 Image bullet_laser = LoadImage("bullet_laser"); 108 109 Image bullet_enemy_01 = LoadImage("bullet_enemy_01"); 109 110 Image bullet_enemy_02 = LoadImage("bullet_enemy_02"); … … 148 149 Image spread_up = LoadImage("spread_up"); 149 150 Image cursor_gui = LoadImage("cursor"); 151 Image select_ship_gui = LoadImage("select_ship"); 150 152 151 153 Image aj = LoadImage("aj-weed"); … … 155 157 SoundEffect hitsfx = LoadSoundEffect("hit"); 156 158 SoundEffect shootsfx = LoadSoundEffect("shoot"); 159 SoundEffect selectsfx = LoadSoundEffect("select1"); 157 160 SoundEffect powerupsfx = LoadSoundEffect("powerup"); 158 161 SoundEffect explosionsfx = LoadSoundEffect("explosion"); … … 164 167 DoubleMeter wpn_spread = new DoubleMeter(1,1,10); 165 168 166 double drd_shootRate = 0. 1;167 double drd_type = 1;169 double drd_shootRate = 0.2; 170 double drd_type = 0; 168 171 IntMeter drd_damageRatio = new IntMeter(1, 1, 20); 169 172 //drd types … … 182 185 GameObject press_start; 183 186 GameObject cursor; 187 GameObject select_ship; 188 Timer cursor_blink; 189 double cursorpos = 0; 190 184 191 bool s001 = false; 185 192 … … 219 226 220 227 Timer start = new Timer(); 221 start.Interval = 0. 06;228 start.Interval = 0.6; 222 229 start.Timeout += delegate 223 230 { … … 229 236 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 230 237 ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); 231 ControllerOne.Listen(Button.Start, ButtonState.Pressed, S tart, null);238 ControllerOne.Listen(Button.Start, ButtonState.Pressed, Select_ship, null); 232 239 233 240 … … 235 242 void Select_ship() 236 243 { 244 selectsfx.Play(); 245 237 246 ClearControls(); 238 247 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 239 248 ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, null); 249 ControllerOne.ListenAnalog(AnalogControl.LeftStick, -0.1, movecursor, null); 250 ControllerOne.Listen(Button.Start, ButtonState.Pressed, Start, null); 251 ControllerOne.Listen(Button.A, ButtonState.Pressed, Start, null); 240 252 241 253 control_gui.Destroy(); … … 244 256 cursor = new GameObject(21, 19); 245 257 cursor.Image = cursor_gui; 246 cursor.Position = Screen.Center; 247 258 cursor.Position = Screen.Center + new Vector(-232, 41); 259 260 select_ship = new GameObject(426, 136); 261 select_ship.Image = select_ship_gui; 262 select_ship.Position = Screen.Center; 263 264 Add(select_ship); 248 265 Add(cursor); 249 266 250 Timercursor_blink = new Timer();251 cursor_blink.Interval = 0. 33;267 cursor_blink = new Timer(); 268 cursor_blink.Interval = 0.5; 252 269 cursor_blink.Timeout += delegate 253 270 { … … 256 273 if (cursor.IsDestroyed) cursor_blink.Stop(); 257 274 }; 258 //cursor_blink.Start(); 275 cursor_blink.Start(); 276 } 277 void movecursor(AnalogState dir) 278 { 279 if (cursorpos!= 0 && dir.StateVector.Y >= 0.7) 280 { 281 cursorpos = 0; 282 cursor.Position = Screen.Center + new Vector(-232, 41); 283 cursor_blink.Start(); 284 cursor.IsVisible = true; 285 selectsfx.Play(); 286 } 287 else if (cursorpos!= 1 &&dir.StateVector.Y <= -0.7) 288 { 289 cursorpos = 1; 290 cursor.Position = Screen.Center + new Vector(-232, -51); 291 cursor_blink.Start(); 292 cursor.IsVisible = true; 293 selectsfx.Play(); 294 } 259 295 } 260 296 261 297 void Start() 262 298 { 299 selectsfx.Play(); 263 300 ClearAll(); 264 301 MediaPlayer.Stop(); … … 269 306 stage_01_start.Position = cntr; 270 307 stage_01_start.Image = stage_1_start; 271 Add(stage_01_start );308 Add(stage_01_start, 3); 272 309 273 310 double i = 0; … … 295 332 Pause(); 296 333 MediaPlayer.Play("Venom"); 334 selectsfx.Play(); 297 335 } 298 336 } … … 478 516 Add(player,2); 479 517 480 playership.Image = player_ship_02; 518 if (cursorpos == 0) 519 { 520 playership.Image = player_ship_01; 521 playership.Size = new Vector(37, 48); 522 } 523 else if (cursorpos == 1) playership.Image = player_ship_02; 481 524 playership.IsVisible = true; 482 525 playership.IgnoresCollisionResponse = true; … … 498 541 499 542 Add(playership, -1); 500 if (drd_type == 1) 543 drd_type = cursorpos; 544 if (drd_type == 0) 501 545 { 502 546 droid(new Vector(-30, 50)); … … 504 548 droid(new Vector(-50, 30)); 505 549 droid(new Vector(-50, -30)); 550 } 551 else if (drd_type == 1) 552 { 553 droid(new Vector(-30, 55)); 554 droid(new Vector(-30, -55)); 555 droid(new Vector(-10, 35)); 556 droid(new Vector(-10, -35)); 506 557 } 507 558 } … … 725 776 drd.IgnoresCollisionResponse = true; 726 777 drd.CollisionIgnoreGroup = 2; 727 drd.Animation = droid_anim; 778 drd.Position = player.Position + pos; 779 if (cursorpos == 0) drd.Animation = droid2_anim; 780 else if (cursorpos == 1) drd.Animation = droid_anim; 728 781 drd.Animation.Start(); 729 if (drd_type == 1) { drd.Position = player.Position + pos;730 782 setdrd_shoot_timer(drd); 731 783 … … 740 792 }; 741 793 move.Start(); 742 };743 //else if744 794 745 795 Add(drd); … … 748 798 { 749 799 Timer drdshoot = new Timer(); 750 drdshoot.Interval = drd_shootRate; 751 drdshoot.Timeout += delegate 752 { 753 if (drd_type == 1) 754 { 755 droidtype1_shoot(drd); 756 } 757 }; 800 if (cursorpos == 0) drdshoot.Interval = drd_shootRate; 801 else if (cursorpos == 1) drdshoot.Interval = 0.05; 802 if (cursorpos == 0) 803 { 804 drdshoot.Timeout += delegate 805 { 806 if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 807 { 808 droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(100, 150)), new Vector(24, 13)); 809 droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(-150, -100)), new Vector(24, 13)); 810 }; 811 }; 812 } 813 else if (cursorpos == 1) 814 { 815 drdshoot.Timeout += delegate 816 { 817 if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 818 { 819 droidlaser(drd.Position + new Vector(37, 0), new Vector(1400, 0), new Vector(70, 5)); 820 }; 821 }; 822 } 758 823 759 824 drdshoot.Start(); 760 825 } 761 void droidtype1_shoot(droid drd) 762 { 763 if (ControllerOne.GetButtonState(Button.B) == ButtonState.Down) 764 { 765 droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(100,150)), new Vector(24, 13)); 766 droidprojectile(drd.Position, new Vector(-400, RandomGen.NextDouble(-150, -100)), new Vector(24, 13)); 767 }; 768 } 826 769 827 void droidprojectile(Vector pos, Vector vel, Vector size) 770 828 { … … 798 856 }; 799 857 angle.Start(); 858 } 859 void droidlaser(Vector pos, Vector vel, Vector size) 860 { 861 bullet projectile = new bullet(size.X, size.Y); 862 projectile.Shape = Shape.Rectangle; 863 projectile.IgnoresGravity = true; 864 projectile.Position = pos; 865 projectile.Tag = "player_bullet"; 866 projectile.Image = bullet_laser; 867 projectile.damage = drd_damageRatio.Value; 868 869 projectile.IgnoresCollisionResponse = true; 870 871 projectile.CollisionIgnoreGroup = 2; 872 projectile.MaximumLifetime = TimeSpan.FromSeconds(1.2); 873 874 AddCollisionHandler<bullet, frontborder>(projectile, destroy); 875 AddCollisionHandler<bullet, enemy>(projectile, damageEnemy); 876 877 Add(projectile, -1); 878 projectile.Hit(vel); 879 800 880 } 801 881 -
2014/30/MikkoL/Gradiant/LM2/LM2Content/GradiantContent.contentproj
r5553 r5556 437 437 </Compile> 438 438 </ItemGroup> 439 <ItemGroup> 440 <Compile Include="select_ship.png"> 441 <Name>select_ship</Name> 442 <Importer>TextureImporter</Importer> 443 <Processor>TextureProcessor</Processor> 444 </Compile> 445 </ItemGroup> 446 <ItemGroup> 447 <Compile Include="select1.wav"> 448 <Name>select1</Name> 449 <Importer>WavImporter</Importer> 450 <Processor>SoundEffectProcessor</Processor> 451 </Compile> 452 </ItemGroup> 453 <ItemGroup> 454 <Compile Include="bullet_laser.png"> 455 <Name>bullet_laser</Name> 456 <Importer>TextureImporter</Importer> 457 <Processor>TextureProcessor</Processor> 458 </Compile> 459 </ItemGroup> 439 460 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 440 461 <!-- 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.