Now we are going to add a blood effect transition before the game starts. This is our first attempt to add transition effects using Windows Presentation Foundation Pixel Shader Effects Library.
1. Open the project
3DInvadersSilverlight
in Visual Studio or Visual C#.2. Expand
MainPage.xaml
in the Solution Explorer and openMainPage.xaml.cs
.3. Add the following lines of code at the beginning of the class definition:
using TransitionEffects; using System.Windows.Media.Imaging;
4. Add the following
private
method,StartGame
:private void StartGame() { }
5. Copy the code inside the
Click
event of the ButtonbtnStartGame
and paste it into the previously mentioned method. Then, comment the first line that collapses the button's visibility://btnStartGame.Visibility = Visibility.Collapsed;
6. Add the following
private
methods to create and apply the transition effect:private Storyboard CreateTransition(TransitionEffect transitionEffect, UIElement element...