Silverlight Games 101

Write games in Silverlight 2 using C# by Bill Reiss
Our upcoming Silverlight book for beginners (includes a great chapter on game development in Silverlight!) Hello! Silverlight 2 with Dave Campbell, available online now!



Pages

    Recent posts

    Navigation

    Archive

    Blogroll

      Tampa Divorce Lawyer

      North of Tampa in Lutz, Florida. A Tampa Divorce Lawyer focusing on family, divorce, and real estate law.

      Disclaimer

      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      Getting Started

      NOTE: This post is obsolete. Please go to this link for more info:

      http://silverlightrocks.com/community/blogs/silverlight_games_101/archive/2008/03/12/back-to-the-beginning-sorta.aspx 

      Source code for this tutorial: http://silverlightrocks.com/Community/files/folders/slg101_tutorials/entry8.aspx

      Ok so now if you have set up your environment by installing everything listed in the last post, we should be ready to create a Silverlight Project.

      In Visual Studio "Orcas", create a new C# project of type "Silverlight Project". Call it "SpaceRocks". This project will be the basis for the first set of tutorials we'll go through.

      Now run your project. If all goes well, one of two things will happen.

      Outcome 1: You will get prompted with a "Get Silverlight Alpha" control. Go ahead and install Silverlight 1.1 Alpha by clicking on the control.

      Outcome 2: You'll get a blank page.

      Ok so by now you should be seeing a blank page. Why a blank page? Well the default background color for a new Silverlight project is White. If you look at your Page.xaml file, it will look like this:

       

      <Canvas x:Name="parentCanvas"
              xmlns="http://schemas.microsoft.com/client/2007" 
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
              Loaded="Page_Loaded" 
              x:Class="SpaceRocks.Page;assembly=ClientBin/SpaceRocks.dll"
              Width="640"
              Height="480"
              Background="White"
              >
      
      </Canvas>

      XAML files are used for forms layout, similar to HTML for a web page. Typically in Silverlight you will lay out your page and controls using XAML and then use code behind to handle the events, kick off animations, etc. Visual Studio "Orcas" does not currently have designer support for Silverlight controls and pages, but if you right click on the file in Solution Explorer, there is an "Open in Expression Blend..." option. Expression Blend is a tool which allows you to lay out XAML based controls, add animations, and more. 

      Back to Visual Studio...change the Background attribute to "Black" and run it again. Now you should have a black box 640x480 inside the browser.

      Posted: May 11 2007, 09:39 by Bill Reiss | Comments (7) RSS comment feed |
      • Currently 0/5 Stars.
      • 1
      • 2
      • 3
      • 4
      • 5
      Filed under:

      Comments

      Comments are closed