Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Terraria;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Diagnostics;
- using TAPI;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Audio;
- namespace MetroidMod
- {
- public class SpeedBoost : ModProjectile
- {
- int SpeedSound = 0;
- int SpeedLoop = 0;
- public SoundEffectInstance soundInstance;
- public override void AI()
- {
- projectile.alpha = 255;
- projectile.light = 1f;
- Player P = Main.player[projectile.owner];
- Vector2 PC = P.position +new Vector2(P.width/2,P.height/2);
- projectile.position.X=PC.X-projectile.width/2;
- projectile.position.Y=PC.Y-projectile.height/2;
- SpeedSound++;
- SpeedLoop++;
- if(SpeedLoop > 74)
- {
- 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);
- SpeedLoop = 60;
- }
- if(SpeedSound > 3 && SpeedSound < 5)
- {
- Main.PlaySound(SoundDef.soundEffects["MetroidMod:SpeedBoosterStartup"],(float)((int)P.position.X), (float)((int)P.position.Y), false, null, float.NaN, float.NaN, float.NaN);
- SpeedSound = 6;
- if(SpeedSound > 6)
- {
- SpeedSound = 6;
- }
- }
- if(((!P.controlRight && !P.controlLeft) || (P.velocity.X > 7 && P.velocity.X < -7)) || P.height == 14 || P.velocity.X == 0 || !MPlayer.mPlayer.speedBoosting)
- {
- if(soundInstance != null)
- {
- soundInstance.Stop(true);
- }
- projectile.Kill();
- }
- foreach(Projectile Pr in Main.projectile) if (Pr!= null)
- {
- if(Pr.active && (Pr.type == ProjDef.byName["MetroidMod:ShineSpark"].type || Pr.type == ProjDef.byName["MetroidMod:SpeedBall"].type))
- {
- if(soundInstance != null)
- {
- soundInstance.Stop(true);
- }
- projectile.Kill();
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement