Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. using Terraria;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Diagnostics;
  6. using TAPI;
  7. using Microsoft.Xna.Framework;
  8. using Microsoft.Xna.Framework.Graphics;
  9. using Microsoft.Xna.Framework.Audio;
  10.  
  11. namespace MetroidMod
  12. {
  13. public class SpeedBoost : ModProjectile
  14. {
  15. int SpeedSound = 0;
  16. int SpeedLoop = 0;
  17. public SoundEffectInstance soundInstance;
  18. public override void AI()
  19. {
  20. projectile.alpha = 255;
  21. projectile.light = 1f;
  22. Player P = Main.player[projectile.owner];
  23. Vector2 PC = P.position +new Vector2(P.width/2,P.height/2);
  24. projectile.position.X=PC.X-projectile.width/2;
  25. projectile.position.Y=PC.Y-projectile.height/2;
  26.  
  27. SpeedSound++;
  28. SpeedLoop++;
  29. if(SpeedLoop > 74)
  30. {
  31. soundInstance = Main.PlaySound(SoundDef.soundEffects["MetroidMod:SpeedBoosterLoop"],(float)((int)P.position.X), (float)((int)P.position.Y), false, null, float.NaN, float.NaN, float.NaN);
  32. SpeedLoop = 60;
  33. }
  34. if(SpeedSound > 3 && SpeedSound < 5)
  35. {
  36. Main.PlaySound(SoundDef.soundEffects["MetroidMod:SpeedBoosterStartup"],(float)((int)P.position.X), (float)((int)P.position.Y), false, null, float.NaN, float.NaN, float.NaN);
  37. SpeedSound = 6;
  38. if(SpeedSound > 6)
  39. {
  40. SpeedSound = 6;
  41. }
  42. }
  43. if(((!P.controlRight && !P.controlLeft) || (P.velocity.X > 7 && P.velocity.X < -7)) || P.height == 14 || P.velocity.X == 0 || !MPlayer.mPlayer.speedBoosting)
  44. {
  45. if(soundInstance != null)
  46. {
  47. soundInstance.Stop(true);
  48. }
  49. projectile.Kill();
  50. }
  51. foreach(Projectile Pr in Main.projectile) if (Pr!= null)
  52. {
  53. if(Pr.active && (Pr.type == ProjDef.byName["MetroidMod:ShineSpark"].type || Pr.type == ProjDef.byName["MetroidMod:SpeedBall"].type))
  54. {
  55. if(soundInstance != null)
  56. {
  57. soundInstance.Stop(true);
  58. }
  59. projectile.Kill();
  60. return;
  61. }
  62. }
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement