public void FireBullet(Player PlayerThatShoots, SoundBank TheSoundBank) { Bullet2 newBullet = new Bullet2(Texture); newBullet.Velocity = new Vector2((float)Math.Cos(PlayerThatShoots.Rotation), (float)Math.Sin(PlayerThatShoots.Rotation)) * 100.0f; newBullet.Position = PlayerThatShoots.Position + newBullet.Velocity * 1.75f; newBullet.Rotation = PlayerThatShoots.Rotation; newBullet.Scale = 1.0f; newBullet.Create(); TheSoundBank.PlayCue("MP5-1"); bullets.Add(newBullet); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //this.IsMouseVisible = true; mPlayerSprite = new Player(); Enemy = new Sprite(); ScreenHeight = graphics.GraphicsDevice.Viewport.Height; ScreenWidth = graphics.GraphicsDevice.Viewport.Width; Enemy.Position = new Vector2(ScreenWidth / 2, ScreenHeight / 2); Enemy.Rotation = 135.0f; shot = false; base.Initialize(); }