O'Reilly logo

3D Game Development with Microsoft Silverlight 3 Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—showing a score gauge

We combined multiple gradients and effects to create an attractive 2D gauge. Now, we are going to make the necessary changes to calculate and show a score while running the 3D game:

  1. Open the project 3DInvadersSilverlight in Visual Studio or Visual C#.
  2. Expand ScoreGauge.xaml in the Solution Explorer and open ScoreGauge.xaml.cs—the C# code for ScoreGauge.xaml. We need to add a method.
  3. Add the following lines of code in the public partial class ScoreGauge : UserControl, to change the score shown in the gauge:
    public void SetScore(int newScore)
    {
    tbkScore.Text = newScore.ToString();
    }
    
  4. Now, expand MainPage.xaml in the Solution Explorer and open MainPage.xaml.cs—the C# code for MainPage.xaml.
  5. Add the following private ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required