void TrooperFire() { // dynamically create a new sprite Fire fire = (Fire)StarTrooperGame.Fire.Clone(); fire.Position = new Vector2(Position.X, Position.Y - 35); fire.Velocity = new Vector2(0, -4); StarTrooperGame.Add(fire); // set the fire sprite active FireballLaunch(new Vector2(Position.X, Position.Y - 35), new Vector2(0, -40), new Vector2(0, -0.5f)); StarTrooperGame.Shoot.Play(); StarTrooperGame.shots++; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); LoadResources(); //Try and load any saved key mappings FileManager.LoadKeyMappings(); //If no settings present or setting were unable to be loaded, use the defaults if (!Input.InputMappings.SettingsSaved) { Input.Load_Defaults(); } Shoot = Content.Load <SoundEffect>(@"Sounds\shoot"); Die = Content.Load <SoundEffect>(@"Sounds\die"); Music = Content.Load <SoundEffect>(@"Music\music"); BackgroundMusic = Music.CreateInstance(); BackgroundMusic.IsLooped = true; BackgroundMusic.Play(); font = Content.Load <SpriteFont>(@"Fonts\SpriteFont1"); ScoreText = new Text2D(font); ScoreText.Text = "Score: " + score.ToString(); ScoreText.Position = new Vector2(10, 10); ScoreText.Color = Color.Red; StarTrooperGame.Add(ScoreText); ShotsText = new Text2D(font); ShotsText.Text = "Shots: " + shots.ToString(); ShotsText.Position = new Vector2(150, 10); ShotsText.Color = Color.Red; StarTrooperGame.Add(ShotsText); // TODO: use this.Content to load your game content here }