<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>The Geek Girl: Tara's Developer Ramblings from the Dorm</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/tarawalker/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/tarawalker/feed.xml</link>
    <description>Tara is a Microsoft Technical Evangelist formerly know as Developer Evangelist.  Currently focusing on Windows 8 &amp;amp; Mobile Cross-Platform development with C# working with Professional &amp;amp; Student/Academic developers.  Dabbling with JavaScript, WinJS,</description>
    <lastBuildDate>Sun, 05 Apr 2015 18:16:01 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Windows 8 Game Development using C#, XNA and MonoGame 3.0: Building a Shooter Game Walkthrough – Part 6: Creating Enemies and Detecting Collisions</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-6-creating-enemies-and-detecting-collisions</link>
      <pubDate>Sun, 25 Aug 2013 21:19:42 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2013/08/25/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-6-creating-enemies-and-detecting-collisions/</guid>
      <description><![CDATA[Overview
Last time we met in Part 5 of this blog series, we created an animation to bring the...]]></description>
      <content:encoded><![CDATA[<p>
 </p><p><span style="color:#323e4f; font-size:20pt">Overview
</span></p><p>Last time we met in <a href="http://blogs.msdn.com/b/tarawalker/archive/2013/04/12/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-5-animating-the-player-ship-and-creating-a-parallaxing-background.aspx"><strong>Part 5</strong></a> of this blog series, we created an animation to bring the ship to life by simulation of movement and propulsion.  We also created and added a more realistic background to the game by the creation of a parallaxing background by layering three distinct images and moving them in and/or of the game screen's view by simulate the sky with clouds moving as the ship flies through the background.  In the comments of <a href="http://blogs.msdn.com/b/tarawalker/archive/2013/04/12/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-5-animating-the-player-ship-and-creating-a-parallaxing-background.aspx"><strong>Part 5</strong></a>, we got some great feedback on the variations of how people handled the Parallaxing background screen refresh on various machines and would not have a smooth jitter.  One such comment and example was well throughout and I want to share it with you all so that you can update your game accordingly if desired.  <strong>Tim Eicher</strong> ( teicher) updated the Shooter parallaxing background by creating a function WrapTextureToLeft and WrapTextureToRight <strong><em>(shown below)</em></strong> and changing the position and scale variables (see full code at <a href="https://bitbucket.org/teicher/shootertutorial">https://bitbucket.org/teicher/shootertutorial</a>.  <strong>Thanks Tim for sharing this Excellent code update with us all! 
</strong></p><ol><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">       private void WrapTextureToLeft(int index)
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        {
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        // If the textures are scrolling to the left, when the tile wraps, it should be put at the
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        // one pixel to the right of the tile before it.
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            int prevTexture = index - 1;
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            if (prevTexture &lt; 0)
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">                prevTexture = _positions.Length - 1;
</span></div></li><li><div style="background: #e7e6e6">
 </div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            _positions[index].X = _positions[prevTexture].X + _texture.Width;
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        }
</span></div></li><li><div style="background: #e7e6e6">
 </div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        private void WrapTextureToRight(int index)
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        {
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            // If the textures are scrolling to the right, when the tile wraps, it should be
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            //placed to the left of the tile that comes after it.
</span></div></li><li><div style="background: #e7e6e6">
 </div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            int nextTexture = index + 1;
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            if (nextTexture == _positions.Length)
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">                nextTexture = 0;
</span></div></li><li><div style="background: #e7e6e6">
 </div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">            _positions[index].X = _positions[nextTexture].X - _texture.Width;
</span></div></li><li><div style="background: #e7e6e6"><span style="font-family:Consolas; font-size:9pt">        }
</span></div></li></ol><p>
 </p><p>Now on with the tutorial.  Let's just into how to create enemies for the game and animate the enemy graphic.
</p><p style="background: white"><a href="http://www.tarathegeekgirl.net/?p=281"><span style="color:#034990; font-family:Segoe UI Semilight"><span style="font-size:12pt">See the Complete Post Here</span><span style="font-size:14pt">
				</span></span></a></p><p>
 </p>]]></content:encoded>
    </item>
    <item>
      <title>Honeycomb Rush Tutorial for Windows 8 (Presentation/Code from MonkeySpace Conference)</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/honeycomb-rush-tutorial-for-windows-8-presentationcode-from-monkeyspace-conference</link>
      <pubDate>Fri, 16 Aug 2013 16:06:42 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2013/08/16/honeycomb-rush-tutorial-for-windows-8-presentationcode-from-monkeyspace-conference/</guid>
      <description><![CDATA[Overview
This tutorial will introduce you to game development on Windows 8 by using the MonoGame...]]></description>
      <content:encoded><![CDATA[<p><span style="color:#323e4f; font-size:22pt">Overview
</span></p><p style="background: white; margin-left: 18pt"><span style="font-family:Segoe UI Semilight"><span style="color:#373737; font-size:12pt">This tutorial will introduce you to game development on Windows 8 by using the <a href="http://monogame.net/" title="MonoGame - an open source implementation of XNA" target="_blank">MonoGame</a> open source library, and Visual Studio 2012. </span><span style="font-size:14pt">
			</span></span></p><p style="background: white; margin-left: 18pt"><span style="font-family:Segoe UI Semilight"><span style="color:#373737; font-size:12pt">During the course of this tutorial, you will build a 2D game by using <strong>MonoGame</strong> while becoming familiar with the key concepts of game development. </span><span style="font-size:14pt">
			</span></span></p><p style="background: white; margin-left: 18pt"><span style="color:#373737; font-family:Segoe UI Semilight; font-size:12pt">The focus of this tutorial is writing a game that has multiple elements on screen at the same time. Since the game must keep track of the elements by rendering them, updating them and tracking the ways in which they interact with each other, this will present a challenge from both a logical and performance perspective. 
</span></p><p style="background: white; margin-left: 18pt"><a href="http://www.tarathegeekgirl.net/?p=221"><span style="font-family:Segoe UI Semilight; font-size:12pt">See the Complete Post Here</span></a><span style="color:#5b9bd5; font-family:Segoe UI Semilight; font-size:14pt">
		</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Public Service Announcement: Blog Update</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/public-service-announcement-blog-update</link>
      <pubDate>Fri, 16 Aug 2013 09:33:32 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2013/08/16/public-service-announcement-blog-update/</guid>
      <description><![CDATA[Hi All:     
As I finalize two great blog posts, I wanted to announce my new blog:...]]></description>
      <content:encoded><![CDATA[<p>
 </p><p><span style="font-family:Segoe UI">Hi All:     
</span></p><p><span style="font-family:Segoe UI">As I finalize two great blog posts, I wanted to announce my new blog: <a href="http://www.tarathegeekgirl.net">www.tarathegeekgirl.net</a>.  No need for alarm, however, my MSDN blog (this one) will be maintained and all new blog posts of the MSDN blog be the summaries of the detailed blog posts located at the new blog site.  You can visit this blog and check out what technology information, tutorials, and/or code samples are being posted at new blog, and if something strikes your eye simply click the link at the end of the summary for the full post. 
</span></p><p><span style="font-family:Segoe UI">Thanks for checking out my blog and joining me on my technical adventures!
</span></p><p><span style="color:#5b9bd5; font-family:Segoe UI"><strong>Up next 2 new blogs posts:</strong>
		</span></p><p><span style="font-family:Segoe UI">Part 6 of the <strong>MonoGame</strong> Shooter Tutorial and walkthrough of my joint Monogame Cross-Platform presentation and code from the great <strong>MonkeySpace </strong>conference (<a href="http://www.monkeyspace.org">www.monkeyspace.org</a>) I had the privileged to be a part of that was held in July.
</span></p><p>Happy Coding!</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8 Game Development using C#, XNA and MonoGame 3.0: Building a Shooter Game Walkthrough – Part 5: Animating the Player/Ship and Creating a Parallaxing Background</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-5-animating-the-playership-and-creating-a-parallaxing-background</link>
      <pubDate>Fri, 12 Apr 2013 00:10:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2013/04/12/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-5-animating-the-playership-and-creating-a-parallaxing-background/</guid>
      <description><![CDATA[Overview 
In Part 4 of this blog series, we added the ability for the user to interact with the...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #323e4f; font-size: 20pt;">Overview </span></p>
<p>In <strong><a title="Part 4" href="http://blogs.msdn.com/b/tarawalker/archive/2013/02/23/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-4-adding-and-processing-player-user-input.aspx">Part 4</a></strong> of this blog series, we added the ability for the user to interact with the game using all forms of User Input, (i.e. Touch, Mouse, GamePad, etc.). Now, we need to make the game much more graphically astute and provide a more pleasurable experience. To do this we need to add some animation and a more realistic background to the game. When we added the graphics in <strong><a title="Part 2" href="http://blogs.msdn.com/b/tarawalker/archive/2012/12/10/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-2-creating-the-shooter-player-asset-of-the-game.aspx">Part 2</a></strong> of this series, we included a sprite sheet which has eight (8) pictures of different states of the player ship. We will now use this to create an animation for the ship's movement. If we treat each of the different picture states of the ship as frames, we can cycle through each frame continuously throughout the game loop to given the illusion of ship fluttering; thus providing animation to the game. In order to provide a realistic background to the Shooter game, we need to simulate the sky with clouds moving as the ship flies through the background.</p>
<p><span style="color: #323e4f; font-size: 20pt;">Create Animation class and methods </span></p>
<p>So now let's add animation to the ship. In order to do this, create a class called <strong>Animation</strong>. Add a new class to your project by right clicking on the <strong>Win8Shooter</strong> project and selecting <strong>Add and New Item, select Class </strong>or by pressing <strong>SHIFT + ALT + C</strong>, and typing in the name <strong>Animation.cs.</strong> Press ENTER.</p>
<p>Inside our new <strong>Animation.cs</strong> code file, replace a few lines at the very top. Delete all the using statements at the top, and replace them with the following lines:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System; </span></span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework; </span></span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Content; </span></span></p>
<p style="background: #deeaf6;"><span style="color: blue;"><span style="font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Graphics;</span></span> </span></p>
<p>Place your cursor just after the {mark inside the Animation class. Add a new line and add the following lines:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The image representing the collection of images used for animation</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Texture2D<span style="color: black;"> spriteStrip; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The scale used to display the sprite strip</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">float<span style="color: black;"> scale; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The time since we last updated the frame</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">int<span style="color: black;"> elapsedTime; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The time we display a frame until the next one</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">int<span style="color: black;"> frameTime; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The number of frames that the animation contains</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">int<span style="color: black;"> frameCount; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The index of the current frame we are displaying</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">int<span style="color: black;"> currentFrame; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The color of the frame we will be displaying</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Color<span style="color: black;"> color; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The area of the image strip we want to display</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Rectangle<span style="color: black;"> sourceRect = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Rectangle<span style="color: black;">(); </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The area where we want to display the image strip in the game</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Rectangle<span style="color: black;"> destinationRect = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Rectangle<span style="color: black;">(); </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Width of a given frame</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> FrameWidth; </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Height of a given frame</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> FrameHeight; </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The state of the Animation</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">bool<span style="color: black;"> Active; </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Determines if the animation will keep playing or deactivate after one run</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">bool<span style="color: black;"> Looping; </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Width of a given frame</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;"> Position; </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize() </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Update() </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw() </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p>You'll notice, much like the Player class, we have an <strong>Initialize()</strong>, <strong>Update()</strong>, and <strong>Draw()</strong> method; animations need all three to be able to work right. Let's start by filling out the <strong>Initialize()</strong> method. We will add some parameters that we can pass in each time we create a new animation, and then we will store the parameters to control the animation.</p>
<p>Replace the <strong>Initialize()</strong> method you just filled in with this version:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize(<span style="color: #2b91af;">Texture2D<span style="color: black;"> texture, <span style="color: #2b91af;">Vector2<span style="color: black;"> position, <span style="color: blue;">int<span style="color: black;"> frameWidth, <span style="color: blue;">int<span style="color: black;"> frameHeight, <span style="color: blue;">int<span style="color: black;"> frameCount, <span style="color: blue;">int<span style="color: black;"> frametime, <span style="color: #2b91af;">Color<span style="color: black;"> color, <span style="color: blue;">float<span style="color: black;"> scale, <span style="color: blue;">bool<span style="color: black;"> looping) </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Keep a local copy of the values passed in</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.color = color; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.FrameWidth = frameWidth; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.FrameHeight = frameHeight; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.frameCount = frameCount; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.frameTime = frametime; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.scale = scale; </span></span></span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Looping = looping; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Position = position; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> spriteStrip = texture; </span></p>
<p style="background: #deeaf6; padding-left: 30px;">&nbsp;</p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the time to zero</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> elapsedTime = 0; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> currentFrame = 0; </span></p>
<p style="background: #deeaf6; padding-left: 30px;">&nbsp;</p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the Animation to active by default</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Active = <span style="color: blue;">true<span style="color: black;">; </span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">}</span></p>
<p>When we initialize a class object, we generally assign the object's variables to copies of the values that are coming in from the parameters. This will come in very handy as we use this Animation class more and more &ndash; you can call <strong>Initialize()</strong> once for every object you want to use animation with different graphics, timings, and sizes, and each Animation object can then run on its own using the data you've passed in. You can have an animation for every object in your game. Like the <strong>Update()</strong> methods in the <strong>Game1 class</strong>, this method operates on <strong>GameTime</strong> &ndash; we'll use this method to do the heavy lifting to decide whether or not enough time has passed in the animation to switch it to the next frame, and do the calculation to turn the frame count into the actual pixels we want to draw on the screen. Replace the <strong>Update()</strong> method in <strong>Animation.cs </strong>you just filled in above with this version:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Update(<span style="color: #2b91af;">GameTime<span style="color: black;"> gameTime) </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Do not update the game if we are not active</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (Active == <span style="color: blue;">false<span style="color: black;">) </span></span></span></span></span><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">return<span style="color: black;">; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Update the elapsed time</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> elapsedTime += (<span style="color: blue;">int<span style="color: black;">)gameTime.ElapsedGameTime.TotalMilliseconds; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// If the elapsed time is larger than the frame time</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// we need to switch frames</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (elapsedTime &gt; frameTime) </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Move to the next frame</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> currentFrame++; </span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// If the currentFrame is equal to frameCount reset currentFrame to zero</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (currentFrame == frameCount) </span></span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> currentFrame = 0; </span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// If we are not looping deactivate the animation</span></span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (Looping == <span style="color: blue;">false<span style="color: black;">) </span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Active = <span style="color: blue;">false<span style="color: black;">; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Reset the elapsed time to zero</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> elapsedTime = 0; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Grab the correct frame in the image strip by multiplying the currentFrame index by the </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: green; font-family: Consolas; font-size: 9pt;">Frame width</span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> sourceRect = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Rectangle<span style="color: black;">(currentFrame * FrameWidth, 0, FrameWidth, FrameHeight);&nbsp;</span></span></span></span></span>&nbsp;</p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Grab the correct frame in the image strip by multiplying the currentFrame index by the frame w</span><span style="color: green; font-family: Consolas; font-size: 9pt;">idth</span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> destinationRect = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Rectangle<span style="color: black;">((<span style="color: blue;">int<span style="color: black;">)Position.X - (<span style="color: blue;">int<span style="color: black;">)(FrameWidth * scale) / 2, </span></span></span></span></span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> (<span style="color: blue;">int<span style="color: black;">)Position.Y - (<span style="color: blue;">int<span style="color: black;">)(FrameHeight * scale) / 2, </span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> (<span style="color: blue;">int<span style="color: black;">)(FrameWidth * scale), </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> (<span style="color: blue;">int<span style="color: black;">)(FrameHeight * scale)); </span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span><strong> </strong></p>
<p>All of the information about which pixels of the sprite sheet need to be drawn is stored in the <strong>sourceRect</strong> and <strong>destinationRect</strong> objects. This is what the <strong>Draw()</strong> method will consume to draw the right frame to the screen. Let's complete the <strong>Draw()</strong> method and our work in this class will be done. Replace the <strong>Draw()</strong> method you just filled in above with this version:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Draw the Animation Strip</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw(<span style="color: #2b91af;">SpriteBatch<span style="color: black;"> spriteBatch) </span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Only draw the animation when we are active</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (Active) </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> spriteBatch.Draw(spriteStrip, destinationRect, sourceRect, color); </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p>Now, any object we want to draw on the screen can be animated using this class. Right now, the game is using a simple <strong>Texture2D</strong> to represent the player graphically on screen, but we can now&nbsp;leverage this class to animate the player graphic on the screen by cycling through each frame of the sprite sheet using the <strong>Animation</strong> class.</p>
<p><span style="color: #323e4f; font-size: 20pt;">Update the Player class to use Animation </span></p>
<p style="text-align: justify;">Now let's use this <strong>Animation</strong> class with the <strong>Player</strong> object to give our player graphic a bit of motion. So switch to the Player class by double-clicking the <strong>Player.cs</strong> file in the Solution Explorer in Visual Studio. Let's start by replacing all the correct namespace for the Animation class in the <strong>Player.cs</strong> file by adding the following line of code under the last <strong>using</strong> statement:</p>
<p style="background: #deeaf6;"><span style="color: blue;"><span style="font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Win8ShooterGame;</span></span> </span></p>
<p>Near the top of the <strong>Player.cs</strong> file, just after the first { mark after the Player class begins, comment out the <strong>public Texture2D PlayerTexture;</strong> and add the following line underneath:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//public Texture2D PlayerTexture;</span></p>
<p style="background: #deeaf6;"><span style="color: blue;"><span style="font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: #2b91af;">Animation<span style="color: black;"> PlayerAnimation;</span></span></span></span> </span></p>
<p>Now that we've removed the old <strong>Texture2D</strong>, there are a number of methods that won't work if we tried to build and run right now. We need to go change them, starting with the <strong>Initialize()</strong> method. Scan down the <strong>Player.cs</strong> file and find the <strong>Initialize() </strong>method. Replace it with the following:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize(<span style="color: #2b91af;">Animation<span style="color: black;"> animation, <span style="color: #2b91af;">Vector2<span style="color: black;"> position) </span></span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> PlayerAnimation = animation; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the starting position of the player around the middle of the screen and to the back</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Position = position; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the player to be active</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Active = <span style="color: blue;">true<span style="color: black;">; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the player health</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> Health = 100; </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p>We also have two properties that are relying on the old texture data. We need to change them. Find the <strong>Width </strong>and <strong>Height</strong> properties in the Player class, and replace them with the following:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> Width </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">get<span style="color: black;"> { <span style="color: blue;">return<span style="color: black;"> PlayerAnimation.FrameWidth; } </span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Get the height of the player ship</span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> Height </span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">get<span style="color: black;"> { <span style="color: blue;">return<span style="color: black;"> PlayerAnimation.FrameHeight; } </span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p>Find the <strong>Draw() </strong>method and replace it with the following:</p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw(<span style="color: #2b91af;">SpriteBatch<span style="color: black;"> spriteBatch) </span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> PlayerAnimation.Draw(spriteBatch); </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p>Finally, find the Update() method in the Player class and replace it with the following:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Update the player animation</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Update(<span style="color: #2b91af;">GameTime<span style="color: black;"> gameTime) </span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> PlayerAnimation.Position = Position; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> PlayerAnimation.Update(gameTime); </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p><span style="color: #323e4f; font-size: 20pt;">Update the Game class to use Animation </span></p>
<p>The only step left is to tell the game to create the Animation and Initialize it with a sprite strip graphical file. The appropriate place to do this is in the <strong>LoadContent()</strong> method, where we were previously loading the static texture. Find the <strong>LoadContent()</strong> method in the <strong>Game.cs</strong> file.</p>
<p>Find the line marked <strong>player.Initialize(Content.Load&lt;Texture2D&gt;("player"), playerPosition)</strong> and replace it with the following:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Load the player resources</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Animation<span style="color: black;"> playerAnimation = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Animation<span style="color: black;">(); </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Texture2D<span style="color: black;"> playerTexture = Content.Load&lt;<span style="color: #2b91af;">Texture2D<span style="color: black;">&gt;(<span style="color: #a31515;">"Graphics\\shipAnimation"<span style="color: black;">); </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">playerAnimation.Initialize(playerTexture, <span style="color: #2b91af;">Vector2<span style="color: black;">.Zero, 115, 69, 8, 30, <span style="color: #2b91af;">Color<span style="color: black;">.White, 1f, <span style="color: blue;">true<span style="color: black;">); </span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Vector2<span style="color: black;"> playerPosition = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;">(GraphicsDevice.Viewport.TitleSafeArea.X, </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> GraphicsDevice.Viewport.TitleSafeArea.Y </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Initialize(playerAnimation, playerPosition);</span></p>
<p>And finally, we need to pass the timing from the game loop's <strong>Update()</strong> method into the Player class, so its <strong>Update()</strong> method can pass that onto the <strong>Animation</strong> class. To do this, we'll put a line in the <strong>UpdatePlayer()</strong>. Find the <strong>UpdatePlayer()</strong> method. At the top of the method, add the following line:</p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Update(gameTime);</span></p>
<p>You should still be able to move the ship around just as in the previous step, but now, you should see some fluttering effects from the sails and steam from the back of the ship.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/7635.animation.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00/7635.animation.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/7635.animation.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00/7635.animation.png" alt="" border="0" /></a></p>
<p><span style="color: #323e4f; font-size: 20pt;">Creating and Drawing a Parallaxing Background </span></p>
<p>Our next step is to perform a bit of visual trickery to give the impression that we are not simply floating in blue space, but rather racing through clouds. We could just draw a single cloud background and move it from right to left, but we can do better. We will draw a parallax background. Parallax is a term used for drawing several layers of images that move at different speeds, giving the illusion of depth</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/7840.cloud%20layer.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00/7840.cloud-layer.png"><img style="float: right;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/7840.cloud%20layer.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00/7840.cloud-layer.png" alt="" width="182" height="140" border="0" /></a></p>
<p><span style="color: #323e4f; font-size: 14pt;">Step 1 &ndash; Create Parallax Background class </span></p>
<p>Create a class for this new type of parallaxing background object, write all the necessary functionality inside it, and then link it up inside our Game1 class. Add a new class to your project by pressing <strong>SHIFT + ALT + C</strong>, and typing in the name <strong>ParallaxingBackground.cs</strong>. Press ENTER.</p>
<p>Inside our new code file, the first thing to do is replace a few lines at the very top. Delete all the using statements at the top, and replace them with the following lines:</p>
<p>&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// ParallaxingBackground.cs</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System; </span></span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework; </span></span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Content; </span></span></p>
<p style="background: #deeaf6;"><span style="color: blue;"><span style="font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Graphics;</span></span> </span></p>
<p>As we did in the <strong>Animation</strong> class, we'll set up all the data we'll need and create in our standard <strong>Initialize(),</strong> <strong>Update(),</strong> and <strong>Draw()</strong> methods to fill in later. Place your cursor just after the { mark inside the <strong>ParallaxingBackground</strong> class. Add a new line and add the following lines of code:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The image representing the parallaxing background</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Texture2D<span style="color: black;"> texture; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// An array of positions of the parallaxing background</span></p>
<p style="background: #deeaf6;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Vector2<span style="color: black;">[] positions; </span></span></p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// The speed which the background is moving</span></p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">int<span style="color: black;"> speed; </span></span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize() </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Update() </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw() </span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">}</span></p>
<p><span style="color: #323e4f; font-size: 14pt;">Step 2 &ndash; Update Parallax Background class to Create Scrolling Background </span></p>
<p>As you can see, it is not a whole lot of data. It has one <strong>Texture2D</strong>, and an array of <strong>Vector2</strong> objects, as shown by the [] marks. An array is a way of storing multiple copies of the same type of object and operating on them quickly. You will see more of these as we go. Finally, we use an <strong>int</strong> to determine the speed of the background. Like we showed in the diagram above, we'll have two parallaxing layers on top of a static background &ndash; so in the end, we'll make two of these <strong>ParallaxingBackground</strong> objects inside the <strong>Game1</strong> class and then a basic <strong>Texture2D</strong> for the static part. The next thing to do is start filling out the methods of this class. Let's start with <strong>Initialize().</strong> We'll write some code that takes in a path to a graphical file and some size and speed parameters to fill out the class data. Replace the<strong> Initialize() </strong>method with the following lines of code:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize(<span style="color: #2b91af;">ContentManager<span style="color: black;"> content, <span style="color: #2b91af;">String<span style="color: black;"> texturePath, <span style="color: blue;">int<span style="color: black;"> screenWidth, <span style="color: blue;">int<span style="color: black;"> screenHeight, <span style="color: blue;">int<span style="color: black;"> speed) </span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgHeight = screenHeight; </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> bgWidth = screenWidth; </span></p>
<p style="background: #deeaf6; padding-left: 30px;">&nbsp;</p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Load the background texture we will be using</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> texture = content.Load&lt;<span style="color: #2b91af;">Texture2D<span style="color: black;">&gt;(texturePath);</span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the speed of the background</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">this<span style="color: black;">.speed = speed; </span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// If we divide the screen with the texture width then we can determine the number of tiles need.</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// We add 1 to it so that we won't have a gap in the tiling</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> positions = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;">[screenWidth / texture.Width + 1]; </span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Set the initial positions of the parallaxing background</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">for<span style="color: black;"> (<span style="color: blue;">int<span style="color: black;"> i = 0; i &lt; positions.Length; i++) </span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">// We need the tiles to be side by side to create a tiling effect</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> positions[i] = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;">(i * texture.Width, 0); </span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><em> </em>} </span></p>
<p>First, we're calling <strong>Load()</strong> to initialize the requested graphic from disk , we've normally done this inside <strong>Game1.LoadContent()</strong>. We're simply passing in the <strong>ContentManager</strong> that does the loading instead. Next, we're filling in the array and giving it a length of <strong>new Vector2[screenWidth / texture.Width + 1]. </strong>In this case, it is dividing the whole screen size by the size of the texture we are using for the background, and then adding 1, so we will always have enough tiles of background plus one more sitting off the edge of the screen so it'll appear to smoothly scroll in. We instantiated the array, but we need to set the values of the Vector2 objects inside the array. The <strong>for</strong> loop is how we create the objects and set each to be a <strong>Vector2</strong> with an X value of <strong>i * texture.Width,</strong> and a Y value of <strong>0</strong>. Inside the <strong>Update()</strong> method, we're going to move our background by changing its <strong>Position</strong> <strong>vector</strong> &ndash; similar to how we move the player's ship inside the <strong>Player</strong> class. Inside the <strong>Update()</strong> method enter the following lines of code:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Update(<span style="color: #2b91af;">GameTime<span style="color: black;"> gametime) </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">// Update the positions of the background</span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">for<span style="color: black;"> (<span style="color: blue;">int<span style="color: black;"> i = 0; i &lt; positions.Length; i++) </span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">// Update the position of the screen by adding the speed</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> positions[i].X += speed; </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// If the speed has the background moving to the left</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (speed &lt;= 0) </span></span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">// Check the texture is out of view then put that texture at the end of the screen</span></span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (positions[i].X &lt;= -texture.Width) </span></span></span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 120px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> positions[i].X = texture.Width * (positions.Length - 1); </span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// If the speed has the background moving to the right</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">else</span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: green;">// Check if the texture is out of view then position it to the start of the screen</span></span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (positions[i].X &gt;= texture.Width * (positions.Length - 1)) </span></span></span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 120px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> positions[i].X = -texture.Width; </span></p>
<p style="background: #deeaf6; padding-left: 90px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p>We're moving each tile of the background along its x-axis &ndash; that's horizontal movement. If the speed is positive, we increase the position in the positive x-axis, which moves the tile to the right. If the speed is negative, we adjust the position in the negative x-axis, moving the tile to the left. If a tile has scrolled completely past the end of the screen, we reset it to the beginning. If you think about what we're doing graphically, it's just a visual trick done off-screen. Because we always have one more tile of background that's outside the screen, we just keep swapping it around; when the tile goes from right to left completely and disappears off screen, we reset it back to outside the screen on the right, so it will slide back into view all over again. Since there's already a tile in view, the player never notices the change. This loop will go on forever and give a feeling of smooth animation with no gaps. We're done updating, now we need to <strong>Draw()</strong> the background. We will create a rectangle that will be the base for the background image that we will draw update with the new position as it moved. Then we will draw texture within the rectangle in the <strong>Draw</strong> method. To accomplish this replace the <strong>Draw()</strong> method with the following code:</p>
<p style="background: #deeaf6;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw(<span style="color: #2b91af;">SpriteBatch<span style="color: black;"> spriteBatch) </span></span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">for<span style="color: black;"> (<span style="color: blue;">int<span style="color: black;"> i = 0; i &lt; positions.Length; i++) </span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: #2b91af;">Rectangle<span style="color: black;"> rectBg = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Rectangle<span style="color: black;">((<span style="color: blue;">int<span style="color: black;">)positions[i].X, (<span style="color: blue;">int<span style="color: black;">)positions[i].Y, bgWidth, bgHeight); </span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: #deeaf6; padding-left: 60px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> spriteBatch.Draw(texture, rectBg, <span style="color: #2b91af;">Color<span style="color: black;">.White);</span></span></span></p>
<p style="background: #deeaf6; padding-left: 30px;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #deeaf6;"><span style="color: black;"><span style="font-family: Consolas; font-size: 9pt;"><strong>}</strong></span></span></p>
<p><span style="color: #323e4f; font-size: 14pt;">Step 3 &ndash; Update Game.cs class to use Parallax Background class/object </span></p>
<p>We now need to create a couple of these background objects in our <strong>Game1 class</strong>, and integrate them into the <strong>Game1 class</strong> methods of <strong>Initialize(), LoadContent(), Update(),</strong> and <strong>Draw() </strong>to get them into the game. Switch to the <strong>Game1 class</strong> by double-clicking the <strong>Game1.cs </strong>file in the Solution Explorer in Visual Studio. Look for the first { mark under the start of the <strong>Game1 class</strong>, and go just below the <strong>float playerMoveSpeed</strong> you added in the input step. Add a new line and then add the following:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Image used to display the static background</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: #2b91af;">Texture2D<span style="color: black;"> mainBackground; </span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: #2b91af;">Rectangle<span style="color: black;"> rectBackground; </span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black;"><span style="font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">float<span style="color: black;"> scale = 1f;</span></span></span> </span></p>
<p>There's our two parallaxing layers and the static third background layer. Now, let's initialize them. Look down the code, find the <strong>Initialize()</strong> method. Inside that method, below <strong>the player = new Player();</strong> add these lines:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//Background</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer1 = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">ParallaxingBackground<span style="color: black;">(); </span></span></span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer2 = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">ParallaxingBackground<span style="color: black;">(); </span></span></span></span></span></p>
<p>So far, so good. Now, we'll load the appropriate textures in from disk in the <strong>LoadContent()</strong> method. Look down the code, find the method called protected override void <strong>LoadContent().</strong> Inside that method, below the <strong>player.Initialize</strong> call, add these lines of code to method:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Load the parallaxing background</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer1.Initialize(Content, <span style="color: #a31515;">"Graphics/bgLayer1"<span style="color: black;">, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, -1); </span></span></span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer2.Initialize(Content, <span style="color: #a31515;">"Graphics/bgLayer2"<span style="color: black;">, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, -2); </span></span></span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: black;"><span style="font-family: Consolas; font-size: 9pt;">mainBackground = Content.Load&lt;<span style="color: #2b91af;">Texture2D<span style="color: black;">&gt;(<span style="color: #a31515;">"Graphics/mainbackground"<span style="color: black;">);</span></span></span></span></span> </span></p>
<p>Just two more to go &ndash; we need to add code to Update and Draw. Look for the <strong>Update()</strong> method inside the <strong>Game1</strong> class, and after the <strong>UpdatePlayer call</strong>, add the following lines:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Update the parallaxing background</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer1.Update(gameTime); </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer2.Update(gameTime); </span></p>
<p>And finally, we'll draw the static background, then the two parallaxing backgrounds on top of it. Careful here! The <strong>order</strong> in which you run these methods is very important. You want to <strong>draw the background first</strong>, then draw the player afterward. If you do it backwards, the background will draw right on top of the player and hide them. Look for the <strong>Draw() </strong>method. Inside the method, before you call <strong>player.Draw()</strong>, add these lines:</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//Draw the Main Background Texture</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">_spriteBatch.Draw(mainBackground, rectBackground, <span style="color: #2b91af;">Color<span style="color: black;">.White); </span></span></span></p>
<p style="background: #deeaf6;">&nbsp;</p>
<p style="background: #deeaf6;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Draw the moving background</span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer1.Draw(_spriteBatch); </span></p>
<p style="background: #deeaf6;"><span style="color: black; font-family: Consolas; font-size: 9pt;">bgLayer2.Draw(_spriteBatch); </span></p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/5635.shipandbackground.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00/5635.shipandbackground.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/5635.shipandbackground.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00/5635.shipandbackground.png" alt="" border="0" /></a></p>
<p>In conclusion, this walkthrough demonstrated how to create an animation class that can be used to animate textures by cycling through the frame sprite sheets. We used this class to animate our player texture and make our ship behave realistically. Afterwards, we went through the steps to create a base background and create the illusion of the sky moving within the game by creating a parallaxing background.</p>
<p>In <strong><a title="Part 6" href="http://blogs.msdn.com/b/tarawalker/archive/2013/08/26/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-6-creating-enemies-and-detecting-collisions.aspx">Part 6</a></strong> of this series, we will add logic to create enemies and animate them through the game, in order to present a challenge for the player of the game.</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8 Game Development using C#, XNA and MonoGame 3.0: Building a Shooter Game Walkthrough – Part 4: Adding and Processing Player (User) Input</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-4-adding-and-processing-player-user-input</link>
      <pubDate>Sat, 23 Feb 2013 09:42:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2013/02/23/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-4-adding-and-processing-player-user-input/</guid>
      <description><![CDATA[Before we get into adding the code to receive and processing input from the player (user) of the...]]></description>
      <content:encoded><![CDATA[<p>Before we get into adding the code to receive and processing input from the player (user) of the Shooter game, there is GREAT news in the MonoGame 3.0 world. <strong>Drum Roll Please&hellip;. </strong></p>
<p>The MonoGame team announced the immediate availability of MonoGame 3.0 Stable version on Jan. 21<sup>st</sup>. The MonoGame team had this to say about their latest release: A lot of work has gone into preparing this major release, with considerable refactoring of the code base to support 3D and enhanced XNA 4.x compatibility. To install the latest release go to <a href="http://www.monogame.net/downloads">http://www.monogame.net/downloads</a> and select your operating system. If you are on Windows, there is a Windows installer which will install the appropriate assemblies and project templates for Visual Studio 2010 and 2012. So what are the cool new things included in this release? Glad you asked! Please note the listing below of new features added with this latest release:</p>
<div>
<table style="border-collapse: collapse;" border="0"><colgroup><col style="width: 293px;" /><col style="width: 345px;" /></colgroup>
<tbody valign="top">
<tr>
<td style="padding-left: 7px; padding-right: 7px; border: solid 0.5pt;">
<p>&bull; 3D support</p>
<p>(courtesy of Infinite Flight Studios Sickhead Games)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid 0.5pt; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; New platforms:</p>
<p>Windows 8, Windows Phone 8, OUYA, PlayStation Mobile (including Vita).</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; Custom Effects.</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; PVRTC support for iOS.</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; iOS supports compressed Songs.</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; Skinned Meshs</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; VS2012 templates</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; New Windows Installer</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; New MonoDevelop Package/AddIn</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; Several bug fixes</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>&bull; Deeper XNA 4 compatibility</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<p>Needless to say the MonoGame team rocks!</p>
<p>Alright, now on with the tutorial and our discussion of adding and tracking user inputs using Keyboard, GamePad, Mouse, and Touch.</p>
<p><span style="color: #323e4f; font-size: 20pt;">Overview </span></p>
<p>Now that we have added our content pipeline and successfully have our player graphic drawing (the golden airship) being rendered on the screen, we can add a critical component that every game needs: Ability to move the player around based on various types of user input. Therefore, this tutorial will show how you can adding input logic enabling the ship to move around the screen, and hopefully save you time, pain, and research of how this should be handled with MonoGame in Windows 8.</p>
<p><span style="color: #323e4f;"><span style="font-size: 20pt;">Updating the Game Loop to Process User Inputs </span></span></p>
<p>Open up the core game file named <strong>Game1.cs</strong> within your Win8ShooterGame project and select the <strong>Update()</strong> method. Like <strong>Draw()</strong> method, the <strong>Update()</strong> method is called automatically many times per second <strong><em>(the target rate is approximately thirty times or more per second).</em></strong> By tracking delta-time taken between calls- of the <strong>Update()</strong> method, incremental changes can be made to the game such as the player's position. Give this is a first person shooter game, the core of the game is the ability for the player to move around the screen. Since Windows 8 devices have a wide range of inputs available, let's add code to take and respond to user input from the keyboard, a Gamepad, the Mouse, and/or a Touch screen. We can write and track input for all four by adding the appropriate Device State object and update them all in the same function in order for all to be processed when needed.</p>
<p><span style="color: #0000ff; font-size: 14pt;">Step 1: Initialization of Game Loop to Process Player inputs </span></p>
<p>First let's add the correct XNA libraries to the Win8ShooterGame. Go to the top of Game1.cs file, where you see the <strong>using</strong> statements. At the end of the list of the using statements on a new line, add the following lines of code:</p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Input; </span></span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Input.Touch; </span></span></p>
<p>Now in order to process the inputs, we need to add objects specific the input type and track the State of each input type. So within the Game1.cs go to the <strong>Player player</strong> declaration line of code. Add a new line directly below this statement and then add the following lines of code:</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Keyboard states used to determine key presses</span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">KeyboardState <span style="color: black;">currentKeyboardState; </span></span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">KeyboardState<span style="color: black;"> previousKeyboardState; </span></span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Gamepad states used to determine button presses</span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">GamePadState<span style="color: black;"> currentGamePadState; </span></span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">GamePadState<span style="color: black;"> previousGamePadState; </span></span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//Mouse states used to track Mouse button press</span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">MouseState<span style="color: black;"> currentMouseState; </span></span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">MouseState<span style="color: black;"> previousMouseState; </span></span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// A movement speed for the player</span></p>
<p style="background: #d9e2f3;"><span style="color: blue;"><span style="font-family: Consolas; font-size: 9pt;">float<span style="color: black;"> playerMoveSpeed;</span></span> </span></p>
<p>Now let's initialize these object when the Game starts by updating the Initialize method. Select the <strong>Initialize()</strong> method from within the Game1.cs file. See <strong>Figure 1</strong> below.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/4401.022313_1805_Windows8Gam1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/4401.022313_5F00_1805_5F00_Windows8Gam1.png" alt="" align="left" /><strong>&nbsp;</strong><strong>Figure 1</strong> <em>Locating the <strong>Initialize() </strong>Method in Game1.cs </em></p>
<p>Within the <strong>Initialize() </strong>Method, find the code which we create a new player (<strong> player = new Player ();). </strong>Underneath this call to the player class constructor, let's add a constant for the speed in which the player object should move. Add the following lines of code:</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Set a constant player move speed</span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">playerMoveSpeed = 8.0f; </span></p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p>Now let's enable Touch for the Game by adding initializing the types of Gestures that should be enabled for our Shooter game. For our Shooter Game we will give users the ability to freely drag the ship using touch. We will discuss the usage of Touch in Windows 8 using MonoGame in more detail when we add the code to handle user Touch input. But now let's initialize the Gesture we desire (FreeDrag) to be used by the game by setting <strong>TouchPanel.EnabledGestures</strong> value which is an enumeration of for various gestures denoted by the <strong>GestureType</strong> enum. Let's accomplish this by adding the following line of code:</p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//Enable the FreeDrag gesture.</span></p>
<p style="background: #d9e2f3;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">TouchPanel<span style="color: black;">.EnabledGestures = <span style="color: #2b91af;">GestureType<span style="color: black;">.FreeDrag; </span></span></span></span></p>
<p>&nbsp;</p>
<p><span style="color: #0000ff; font-size: 14pt;">Step 2 &ndash; Create an UpdatePlayer method to Handle Updates from User Input (Keyboard/GamePad) </span></p>
<p>We could now add the actual input code directly to <strong>Update()</strong> method, but we will encapsulate it into our own method called <strong>UpdatePlayer(),</strong> and do all our work there, then just call it from Update(). That will keep the <strong>Update()</strong> method from getting messy. Create a brand new method inside <strong>Game1.cs</strong>, directly below the <strong>Update()</strong> method, called <strong>UpdatePlayer()</strong> by adding the following code:</p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">private<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> UpdatePlayer(<span style="color: #2b91af;">GameTime<span style="color: black;"> gameTime) </span></span></span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p>Now inside the method, add controls for processing inputs for moving up, down, left, and right by add the following lines inside the <strong>UpdatePlayer() </strong>method:</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Get Thumbstick Controls</span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Position.X += currentGamePadState.ThumbSticks.Left.X * playerMoveSpeed; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Position.Y -= currentGamePadState.ThumbSticks.Left.Y * playerMoveSpeed; </span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;">&nbsp;<span style="color: green; font-family: Consolas; font-size: 9pt;">// Use the Keyboard / Dpad</span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">if<span style="color: black;"> (currentKeyboardState.IsKeyDown(<span style="color: #2b91af;">Keys<span style="color: black;">.Left) || currentGamePadState.DPad.Left == <span style="color: #2b91af;">ButtonState<span style="color: black;">.Pressed) </span></span></span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Position.X -= playerMoveSpeed; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">if<span style="color: black;"> (currentKeyboardState.IsKeyDown(<span style="color: #2b91af;">Keys<span style="color: black;">.Right) || currentGamePadState.DPad.Right == <span style="color: #2b91af;">ButtonState<span style="color: black;">.Pressed) </span></span></span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Position.X += playerMoveSpeed; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">if<span style="color: black;"> (currentKeyboardState.IsKeyDown(<span style="color: #2b91af;">Keys<span style="color: black;">.Up) || currentGamePadState.DPad.Up == <span style="color: #2b91af;">ButtonState<span style="color: black;">.Pressed) </span></span></span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Position.Y -= playerMoveSpeed; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">if<span style="color: black;"> (currentKeyboardState.IsKeyDown(<span style="color: #2b91af;">Keys<span style="color: black;">.Down) || currentGamePadState.DPad.Down == <span style="color: #2b91af;">ButtonState<span style="color: black;">.Pressed) </span></span></span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> player.Position.Y += playerMoveSpeed; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Make sure that the player does not go out of bounds</span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Position.X = <span style="color: #2b91af;">MathHelper<span style="color: black;">.Clamp(player.Position.X, 0, GraphicsDevice.Viewport.Width - player.Width); </span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black;"><span style="font-family: Consolas; font-size: 9pt;">player.Position.Y = <span style="color: #2b91af;">MathHelper<span style="color: black;">.Clamp(player.Position.Y, 0, GraphicsDevice.Viewport.Height - player.Height);</span></span></span> </span></p>
<p>Now that we have our <strong>UpdatePlayer()</strong> method, we will call the method we wrote from the Game's Update() method so that every time <strong>Update() </strong>is called by the game loop, it will call our <strong>UpdatePlayer()</strong> method. Anything we want to update every frame should be done the same way.</p>
<p>Look for the <strong>Update()</strong> method inside the <strong>Game1 class</strong>, and replace the line marked "// TODO: Add your update logic here" with the following code:</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Save the previous state of the keyboard and game pad so we can determine single key/button presses</span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">previousGamePadState = currentGamePadState; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">previousKeyboardState = currentKeyboardState; </span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Read the current state of the keyboard and gamepad and store it</span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">currentKeyboardState = <span style="color: #2b91af;">Keyboard<span style="color: black;">.GetState(); </span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">currentGamePadState = <span style="color: #2b91af;">GamePad<span style="color: black;">.GetState(<span style="color: #2b91af;">PlayerIndex<span style="color: black;">.One); </span></span></span></span></span></p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//Update the player</span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">UpdatePlayer(gameTime);</span></p>
<p>You have written all the input code you will need to get your ship moving using the Keyboard and GamePad. Let's test the effort by running the game either on the Local Device or in the Windows Simulator. Again if you are successful, you'll see the game pop up on your chosen platform. Now move the ship (player) around the screen by pressing the arrow keys on your keyboard.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/3324.022313_1805_Windows8Gam2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/3324.022313_5F00_1805_5F00_Windows8Gam2.png" alt="" align="left" /><strong>Figure 2</strong> <em>Ship/Player Moved on Screen via User Input (Keyboard) </em></p>
<p>&nbsp;</p>
<p><span style="color: #0000ff; font-size: 14pt;">Step 3 &ndash; Create an UpdatePlayer method to Handle User Input from Mouse and Touch </span></p>
<p>Now that we've set up our game to accept user input to move the player from the keyboard and/or gamepad, now let add the code to enable use of the Mouse and/or Touch to control our ship aka player. Now our task is to start enabling the mouse and touchscreen for our game, and well that's when it gets very interesting. If you read any documentation about Windows 8, you will find that Windows 8 WinRT APIs supports user input across input modes and devices (touch, mouse, pen) through three types of interaction events: pointer, gesture, and manipulation. <strong>Pointer</strong> events provide a unified to access mouse, touch, and pen data. <strong>Gestures</strong> can be anything from simple interactions like tapping to more complicated manipulations like zooming, panning, and rotating. Touch, mouse, and pen/stylus interactions are received, processed, and managed as Pointer object input in Windows Store apps. In addition to the aforementioned objects and associated event structure, WinRT exposes a <strong>GestureRecognizer</strong> object for more control over specific gestures, such as Pinch, Slide, etc.</p>
<p>So with this information in hand, I implemented the Pointer event handlers against the <strong>XAML GamePage</strong> hosting the XNA Game. Unfortunately, the pointer event was not being raised when I clicked the screen. So I set about debugging the pointer events with the <strong>XAML GamePage</strong> and the <strong>XAML MetroGamePlatform</strong>, as well as, debugging through all the initialization events and the studying order in which each was called. Despite all of the effort, there was no way that I could get any of the Pointer or the Gesture events to successfully fire upon Mouse press. Luckily in researching the Touch objects on the MonoGame documentation hosted on <a href="http://monogame.codeplex.com">http://monogame.codeplex.com</a> , I stumbled upon a thread about the implementation of the MonoGame touch and gesture events. In order to provide a consistent experience with XNA and behavior similar to the XNA implementation on Windows Phone 7, the <strong>TouchPanel</strong> and <strong>MouseState</strong> objects should be used. Therefore, instead of leveraging the <strong>Pointer</strong> and <strong>Gesture</strong> events, we will enable mouse and touch with the aforementioned objects.</p>
<p>So let's add the code for accepting user input for Touch. We have already added the type of Gesture that will be supported by this code when we added the Gesture Type: <strong>FreeDrag</strong>. Therefore, let's go back to the <strong>UpdatePlayer()</strong> method and before the <strong>GamePad/Thumbstick</strong> controls code and its related comment and on a line right above; Add the following code:</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Windows 8 Touch Gestures for MonoGame</span></p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">while<span style="color: black;"> (<span style="color: #2b91af;">TouchPanel<span style="color: black;">.IsGestureAvailable) </span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: #2b91af;">GestureSample<span style="color: black;"> gesture = <span style="color: #2b91af;">TouchPanel<span style="color: black;">.ReadGesture(); </span></span></span></span></span></p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">if<span style="color: black;"> (gesture.GestureType == <span style="color: #2b91af;">GestureType<span style="color: black;">.FreeDrag) </span></span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> player.Position += gesture.Delta; </span></p>
<p style="background: #d9e2f3;">&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;} </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">}</span></p>
<p>Now let's add the code for responding user input for Mouse. Unlike using the <strong>TouchPanel</strong>, with a <strong>GestureSample</strong> object which calculates the delta of the touch/pointer position and the player (ship) position, we will have to manually calculate delta. To accurately calculate the mouse position, we create a <strong>Vector2</strong> with the X and Y coordinates of the current <strong>MouseState</strong> by using the <strong>currentMouseState</strong> variable as noted below:</p>
<p style="background: #d9e2f3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">//Get Mouse State then Capture the Button type and Respond Button Press</span></p>
<p style="background: #d9e2f3;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Vector2<span style="color: black;"> mousePosition = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;">(currentMouseState.X, currentMouseState.Y); </span></span></span></span></span></span></p>
<p>&nbsp;</p>
<p>Now let's check if the Button pressed on the Mouse is the Left button. If it is indeed the Left Button that has been pressed, our next step will be to calculate the delta my subtracting the Mouse position from the player object current position. Once have the delta, we then will call the <strong>Normalize</strong> method on this. I found the use of this method beneficial as it creates a unit vector with one unit in length pointing in the same direction as the original vector. Finally, we would need to multiply the delta by the player speed and add that to the player current position. The result is the player (ship) moving where the mouse is clicked or the player following the direction of mouse movement when holding down the left button and moving around the screen which is similar to touching and dragging your finger around the screen. So in order to complete the tasks mentioned above, add the following code below the creation of the <strong>mousePosition</strong> vector.</p>
<p>&nbsp;</p>
<p style="background: #d9e2f3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">if<span style="color: black;"> (currentMouseState.LeftButton == <span style="color: #2b91af;">ButtonState<span style="color: black;">.Pressed) </span></span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #2b91af;">Vector2<span style="color: black;"> posDelta = mousePosition - player.Position; </span></span></span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> posDelta.Normalize(); </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> posDelta = posDelta * playerMoveSpeed; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> player.Position = player.Position + posDelta; </span></p>
<p style="background: #d9e2f3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p>You're all done and now have written all the input code you will need to get your ship moving using the mouse, as well as, using gestures and touch. Let's test the effort my running the game either on the Local Device or in the Windows Simulator. Again if you are successful, you'll see the game pop up on your chosen platform. Now move the ship (player) around the screen by clicking and holding your mouse and/or via touch if you have access to a touchscreen.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/8611.022313_1805_Windows8Gam3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/8611.022313_5F00_1805_5F00_Windows8Gam3.png" alt="" /></p>
<p><strong>Figure 3</strong> <em>Ship/Player Moved on Screen via User Input (Mouse/Touch) </em></p>
<p>&nbsp;</p>
<p>In conclusion, this walkthrough demonstrated how to respond to user input from the keyboard, gamepad, mouse and touch by adding the appropriate input logic. We went through the step to create and leverage the keyboard and gamepad state, and update the position of the player in response to keyboard/gamepad input. We learned about the handling of of the gesture and mouse screen in MonoGame is different than the typical Windows RT unified and streamlined way to get mouse, touch, and pen data with gesture and pointer events. We now have a ship that we can move around the screen, but without any animation, our game does not have an engaging experience. In<a title="Part 5" href="http://blogs.msdn.com/b/tarawalker/archive/2013/04/12/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-5-animating-the-player-ship-and-creating-a-parallaxing-background.aspx"> <strong>Part 5</strong></a> of this series, we will add logic to animate the ship by building a simple animation system within the game.</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8 Game Development using C#, XNA and MonoGame 3.0: Building a Shooter Game Walkthrough – Part 3: Updating Graphics using Content Pipeline with MonoGame</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame</link>
      <pubDate>Fri, 04 Jan 2013 11:04:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame/</guid>
      <description><![CDATA[&nbsp;
Overview 
MonoGame currently does not have a Content Pipeline as a part of the framework...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 20pt;">Overview </span></p>
<p>MonoGame currently does not have a Content Pipeline as a part of the framework therefore we will need another way to create the XNB files from our graphic and sounds assets. That is where the Windows Phone SDK comes in with Visual Studio 2012 (WP 8.0 SDK) and/or Visual Studio 2010 (WP 7.1 SDK) comes in. You can use the XNA Windows Phone Game project under Visual Studio 2012 or Visual Studio 2010 to compile your graphics assets and then add them to your Visual Studio 2012 MonoGame project. <strong>Please note</strong>: The graphics shown in this blog post may either depict usage of VS 2012 OR VS 2010 for the Content Pipeline but the steps for completion are the same no matter which product (VS 2012 or VS 2010) is used.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 20pt;">Creating a Content Pipeline for MonoGame </span></p>
<p>To create a Content Pipeline for MonoGame we must leverage the XNA Game Studio inside of Visual Studio 2012 or Visual Studio 2010 which is installed with Windows Phone 8 SDK (VS 2012) or Windows Phone 7.1 (VS 2010). So the first step in creating a Content Pipeline for your game is to start Visual Studio (2010/2012), and select XNA Game Studio from the Templates.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 14pt;">Step 1 &ndash; Opening and Registering Visual Studio 2012/2010 Express (First Time Users) </span></p>
<p>However, if this is your first time using Visual Studio 2012 or 2010 Express for Windows Phone, you will get a dialog box prompting for you to get a Registration Key. Click the Obtain a registration key online button.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/7774.010413_1921_Windows8Gam1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/7774.010413_5F00_1921_5F00_Windows8Gam1.png" alt="" align="left" /><strong></strong></p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Figure 1</strong> <em>Visual Studio 2010 Express registration </em></p>
<p>&nbsp;</p>
<p>This will open up a Sign in screen, Log in with your email address and password associated with your Windows Live ID (Microsoft Account) or associate your email address with Window Live by registering your email address as a Windows Live ID and login. Fill out information require (if any) and then click the Submit button. If you are successful, a Thank You for registering message should come up displaying your registration key. <em>See Fig. 2 below.</em> <em> </em></p>
<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/1411.010413_1921_Windows8Gam2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/1411.010413_5F00_1921_5F00_Windows8Gam2.png" alt="" align="left" /><em> </em></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Figure 2</strong> <em>Visual Studio Registration Confirmation Dialog Box</em></p>
<p>&nbsp;</p>
<p>Copy the registration key displayed, and paste it into the registration dialog shown previously in <strong>Figure 1.</strong> The <strong>Register Now</strong> button should now become available, therefore, Click the <strong>Register Now</strong> button.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 14pt;">Step 2 &ndash; Creating the XNA Game Project </span></p>
<p>Once Visual Studio starts, select New Project. Select Windows Phone Game, Windows Game or XBOX Game as appropriate to the version of Visual Studio you are using. Name the project ShooterContent and click OK. See <strong>Fig 1a</strong> and <strong>Fig 1b</strong>.</p>
<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/6685.010413_1921_Windows8Gam3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/6685.010413_5F00_1921_5F00_Windows8Gam3.png" alt="" align="left" /><strong></strong></p>
<p><strong></strong>&nbsp;</p>
<p><strong>Figure 1a</strong> <em>Visual Studio 2012 XNA Game 4.0 Project </em></p>
<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/8322.010413_1921_Windows8Gam4.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/8322.010413_5F00_1921_5F00_Windows8Gam4.png" alt="" align="left" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Figure 1b </strong><em>Visual Studio 2010 XNA Game 4.0 Project</em></p>
<p>&nbsp;</p>
<p>Now obtain the graphics for the Shooter game. I have provided these graphics for you. Click on the link: <a href="http://sdrv.ms/RBzIAh">http://sdrv.ms/RBzIAh</a> and Click on the Shooter Graphics and Sound files folder. Download all of the files contained within that folder and subfolders to an accessible location on your computer.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 14pt;">Step 3 &ndash; Creating a Content Manager for the Graphic, Font, and Sound Files using XNA Content Pipeline </span></p>
<p>Now that your XNA Windows Game project (ShooterContent) has been created, we can create a content manager. In the Solution Explorer, right click on the <strong>ShooterContentContent (Content)</strong> project and add two (2) new folders. Name the folders <strong>Graphics</strong> and <strong>Sound</strong> respectively. Add all the graphic files <em>(.png files) </em>and font files <em>(.spritefont)</em> from the location in which you downloaded the files provided above into the Graphics folder. Add the sound files <em>(.wav)</em> from the location in which you downloaded the files provided above the Sound folder. See <strong>Figure 1</strong> below.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/0312.010413_1921_Windows8Gam5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/0312.010413_5F00_1921_5F00_Windows8Gam5.png" alt="" /></p>
<p><strong>Figure 1 </strong><em>Visual Studio 2010 Express - Adding Content files to the Content Pipeline</em></p>
<p>&nbsp;</p>
<p>Once all the files are added into your XNA Game solution and your XNA Game Studio project Solution Explorer resembles the graphic shown in <strong>Figure 1</strong> above. Compile/Build the Entire <strong>ShooterContent</strong> Solution. Once you have successfully compiled without error, you can close the <strong>ShooterContent </strong>XNA Game Studio project.</p>
<p><strong>&nbsp;</strong></p>
<p><span style="color: #17365d; font-size: 14pt;">Step 4 &ndash; Creating a Content Manager for the Graphic, Font, and Sound Files using XNA Content Pipeline </span></p>
<p>Now Reopen your MonoGame Project . If you have followed along with <a href="http://blogs.msdn.com/b/tarawalker/archive/2012/12/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-1-overview-installation-monogame-3-0-project-creation.aspx"><strong>Part 1</strong></a> and <a href="http://blogs.msdn.com/b/tarawalker/archive/2012/12/10/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-2-creating-the-shooter-player-asset-of-the-game.aspx"><strong>Part 2</strong></a> of this MonoGame blog series, in the Solution Explorer you will see a Graphics folder with an .xnb file once the project has opened. For clarity and to ensure there no conflicts with our next steps. Delete the Graphics folder and all its contents from your project. Clean and rebuild the solution.</p>
<p>Inside the Solution Explorer, go to <strong>Win8ShooterGame</strong> project root and add a folder named <strong>Content</strong> by right-clicking and choosing Add, New Folder. Underneath this new folder, add two new folders named <strong>Graphics</strong> and <strong>Sound</strong> by right-click on Content Folder and choosing Add, New Folder. See graphic in <strong>Figure 1</strong> shown below.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/0728.010413_1921_Windows8Gam6.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/0728.010413_5F00_1921_5F00_Windows8Gam6.png" alt="" align="left" /></p>
<p><strong>Figure 1</strong> <em>Adding Content Folders to the Project</em></p>
<p>Now Right click on Graphics Folder and select Add, Existing Item. Navigate to C:\Users\<strong><em>[you]</em></strong>\Documents\Visual Studio 2012\Projects\ShooterContent\ShooterContent\ShooterContent\bin\x86\Debug\Content\Graphics or C:\Users\\Documents\Visual Studio 2010\Projects\<em><strong>[you]</strong>\S</em>hooterContent\ShooterContent\ShooterContent\bin\x86\Debug\Content\Graphics</p>
<p>Select all the files located in this folder and Click Add.</p>
<p>Select the Sound Folder and select Add, Existing Item. Navigate to C:\Users\<strong><em>[you]</em></strong>\Documents\Visual Studio 2012\Projects\ShooterContent\ShooterContent\ShooterContent\bin\x86\Debug\Content\Sound or C:\Users\\Documents\Visual Studio 2010\Projects\<em><strong>[you]</strong>\S</em>hooterContent\ShooterContent\ShooterContent\bin\x86\Debug\Content\Sound</p>
<p>Select all the files located in this folder and Click Add.</p>
<p><strong><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/5102.010413_1921_Windows8Gam7.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/5102.010413_5F00_1921_5F00_Windows8Gam7.png" alt="" align="left" /></strong></p>
<p><strong></strong>&nbsp;</p>
<p><strong>Figure 2</strong> <em>Adding Graphics files to MonoGame project folders</em></p>
<p>Once files have been added within your MonoGame project, select add the files in the Graphics folder. With the files selected, right-click and select Properties.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/1805.010413_1921_Windows8Gam8.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/1805.010413_5F00_1921_5F00_Windows8Gam8.png" alt="" align="left" /></p>
<p>&nbsp;<strong>Figure&nbsp;3</strong> <em>Select the Properties option for files</em></p>
<p>Under properties, set Build Action to property to <strong>Content</strong> and Copy to Output Directory property to <strong>Copy Always.</strong> Repeat these same steps with the files in the Sound folder.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/8738.010413_1921_Windows8Gam9.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/8738.010413_5F00_1921_5F00_Windows8Gam9.png" alt="" align="left" /><strong> </strong></p>
<p><strong></strong>&nbsp;</p>
<p><strong>Figure&nbsp;4</strong> Change <em>Properties options of the files</em>&nbsp;</p>
<p>You've written enough code for now - let's see it in action! Build and run your game by either via Local Device or and the Windows Simulator. If successful, you will see the Cornflower Blue background with the Ship (player) shown on the screen.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/2860.010413_1921_Windows8Gam10.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/2860.010413_5F00_1921_5F00_Windows8Gam10.png" alt="" align="left" /><strong></strong></p>
<p><strong>Figure&nbsp;5</strong> <em>Ship/Player Drawn on the Screen </em></p>
<p>In this walkthrough, we went through the step to create and leverage the Content Pipeline for graphics and sound. Now have created your Content pipeline and added the needed graphic and sound files, these files can be leveraged for the Shooter game. The Shooter player graphic is loaded and displayed on the screen from the Content Pipeline generated graphic files. In <strong><a title="<strong>Part 4</strong>" href="http://blogs.msdn.com/b/tarawalker/archive/2013/02/23/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-4-adding-and-processing-player-user-input.aspx">Part 4</a></strong> of this series, we will add input logic and code to respond to various types of user input and control the player (ship) within the game. The input logic should respond to the user input in using mouse, keyboard and gestures.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Home for the Holidays? How about a Holiday App Challenge to Pad those Worn Pockets..</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/home-for-the-holidays-how-about-a-holiday-app-challenge-to-pad-those-worn-pockets</link>
      <pubDate>Fri, 14 Dec 2012 20:02:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2012/12/14/home-for-the-holidays-how-about-a-holiday-app-challenge-to-pad-those-worn-pockets/</guid>
      <description><![CDATA[&nbsp;

Want to Have a Very Appy (yes Appy) Holiday? Looking for a way to make some Extra Money...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/2671.121512_0401_HomefortheH1.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/2671.121512_5F00_0401_5F00_HomefortheH1.jpg" alt="" /></p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;">Want to Have a Very Appy <em>(yes Appy)</em> Holiday? Looking for a way to make some Extra Money ($$) over the holidays? You happen to be a student? </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;">Well do I have a Holiday Deal for you&hellip;Take the Windows 8 Student Holiday App Challenge and win $100 for <strong>each</strong> published Windows 8 app! <br /><br /><strong>What is the Windows 8 Student Holiday App Challenge?</strong> </span></p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;">A challenge for students to create and publish Windows 8 apps by Jan. 20th and win a $100 gift card for <strong>EACH</strong> published app up to 5 applications. </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;">Ready to get Started, Sure You Are! </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;"><strong>Get Started</strong> by going to <a href="https://aka.ms/w8holidaychallenge">https://aka.ms/w8holidaychallenge</a> to Download all the software and get the Support you Need and get more information about the contest. </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;"><strong>Need Assistance</strong> getting started in building your app; Check out some Hands-On Labs, Sample Code, and Interactive Videos on </span></p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;">Generation App: <a href="http://bit.ly/RhnDfx">http://bit.ly/RhnDfx</a> or the Microsoft Student Windows 8 page: <a href="http://bit.ly/RIro4E">http://bit.ly/RIro4E</a> </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="background: white; margin-left: 14pt;"><span style="color: #333333; font-family: Segoe UI; font-size: medium;"><strong>Got Technical Questions?</strong> Get your technical questions answered and talk to other student developer by going <a href="https://aka.ms/w8holidaychallenge">https://aka.ms/w8holidaychallenge</a> </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="background: white; margin-left: 14pt;"><span style="font-family: Segoe UI; font-size: medium;">Happy Holidays and Happy Coding! </span></p>
<p style="background: white; margin-left: 14pt;">&nbsp;</p>
<p style="text-align: center; background: white; margin-left: 14pt;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/2275.121512_0401_HomefortheH2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/2275.121512_5F00_0401_5F00_HomefortheH2.png" alt="" /></p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8 Game Development using C#, XNA and MonoGame 3.0: Building a Shooter Game Walkthrough – Part 2: Creating the Shooter/Player Asset of the Game</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-2-creating-the-shooterplayer-asset-of-the-game</link>
      <pubDate>Mon, 10 Dec 2012 20:28:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2012/12/10/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-2-creating-the-shooterplayer-asset-of-the-game/</guid>
      <description><![CDATA[Overview 
The Shooter game from the XNA Game tutorial is a particular type of game with a set of...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #17365d; font-size: 20pt;">Overview </span></p>
<p>The Shooter game from the XNA Game tutorial is a particular type of game with a set of well-defined limits around user interaction. Given these well-defined parameters we can leverage touch aspects of Windows 8 as well as other forms of user interaction for the user in playing the Shooter Game. In leveraging the XNA Framework, we find that the framework Game class implements a basic design using the game loop concept. With this concept, XNA provides not only a base window to display the game, but also provides overloadable methods that a game implements to facilitate communication between your game and the operating system. We will discuss more details around XNA game development and resources throughout this walkthrough. In Part 2 of this series, we will build the code and class to Draw a player character i.e. Shooter on the screen and add the code needed to receive input and move the player around. For an overview of MonoGame and installation information, please see Part 1 of this Blog Series <a href="http://blogs.msdn.com/b/tarawalker/archive/2012/12/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-1-overview-installation-monogame-3-0-project-creation.aspx">Part 1: Overview, Installation, MonoGame 3.0 Project Creation</a>.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 20pt;">Creating the Shooter </span></p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 14pt;">Step 1 &ndash; Create the Player Class </span></p>
<p>Start Visual Studio 2012, and open the Win8ShooterGame solution that was created in Part 1 of this series. Currently this solution contains a blank MonoGame/XNA project that when run displays the default XNA Cornflower blue screen, as shown below.</p>
<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/2112.121112_0428_Windows8Gam1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/2112.121112_5F00_0428_5F00_Windows8Gam1.png" alt="" align="left" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Select the <strong>Win8ShooterGame project</strong>. Add a new class to your project by pressing SHIFT + ALT + C or right click on the Win8ShooterGame project and click Add New Item and selecting a Class. Name the class by typing in <strong>Player.cs</strong>. Press ENTER. A brand new code file will be created and a code window will open up. This file will contain all the code we'll write to define the player class. This includes all the data and functions that describe what the shooter/player will do within the constructs of the Shooter game. We'll start with basic values such as position, and add a few functions we can call continuously to draw the player on the screen. Additionally, later in this walkthrough we will add functions later move the player around later.</p>
<p>Once the Player.cs file is created, the default class created will show the following code:</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System.Collections.Generic; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System.Linq; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System.Text; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System.Threading.Tasks; </span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">namespace<span style="color: black;"> Win8ShooterGame </span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp; <span style="color: blue;">class<span style="color: black;"> <span style="color: #2b91af;">Player</span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp; { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;} </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">}</span></p>
<p>&nbsp;</p>
<p>Since we need access to the XNA framework and associated functionality, we need to add the using statements to the class for the XNA framework. Therefore all the following code shown below to the end of the list of using statements in the Player class file. You have the option to remove all of the using statements placed in the class object by default Except the using System, as we will not being using any of those class objects for the Player class. Also let's change the namespace to better represent the player class object by changing the namespace from Win8ShooterGame to Shooter.</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Graphics; </span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">namespace<span style="color: black;"> Shooter </span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp; class<span style="color: black;"> <span style="color: #2b91af;">Player</span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp; { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;} </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p>&nbsp;</p>
<p>Now within the class Player definition, let's add the stub for the methods that will be used by the game to setup, update, and draw the Shooter player within the game. Add the following code shown below to your Player class.</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> System; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework; </span></span></p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Microsoft.Xna.Framework.Graphics; </span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">namespace<span style="color: black;"> Shooter </span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">{ </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp;&nbsp; class<span style="color: black;"> <span style="color: #2b91af;">Player</span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp; { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize() </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Update() </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw() </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp; } </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">} </span></p>
<p>Now let's add some <em>variables</em> to can store player data and information needed to ensure we can create and update the Shooter player accurately. Look for the first { mark under <strong>class Player</strong>, and enter the following lines:</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Animation representing the player</span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: #2b91af;">Texture2D<span style="color: black;"> PlayerTexture; </span></span></span></span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Position of the Player relative to the upper left side of the screen</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;"> Position; </span></span></span></span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// State of the player</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">bool<span style="color: black;"> Active; </span></span></span></span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Amount of hit points that player has</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> Health; </span></span></span></span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Get the width of the player ship</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> Width </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp; get<span style="color: black;"> { <span style="color: blue;">return<span style="color: black;"> PlayerTexture.Width; } </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: green;">// Get the height of the player ship</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> <span style="color: blue;">public<span style="color: black;"> <span style="color: blue;">int<span style="color: black;"> Height </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp; get<span style="color: black;"> { <span style="color: blue;">return<span style="color: black;"> PlayerTexture.Height; } </span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> } </span></p>
<p>&nbsp;</p>
<p>Now let's write the code to setup the Shooter player's starting position, set the graphic (texture), set the player status, and finally set the Health of the player. To do this, we add code to the Initialize method we created in the Player class object. Change code of the <strong>Initialize</strong> method to add the code showing below:</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Initialize(<span style="color: #2b91af;">Texture2D<span style="color: black;"> texture, <span style="color: #2b91af;">Vector2<span style="color: black;"> position) </span></span></span></span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp; PlayerTexture = texture; </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: green;">&nbsp;&nbsp;&nbsp; // Set the starting position of the player around the middle of the screen and to the back</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp; Position = position; </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: green;">&nbsp;&nbsp;&nbsp; // Set the player to be active</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp; Active = <span style="color: blue;">true<span style="color: black;">; </span></span></span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"><span style="color: green;">&nbsp;&nbsp; // Set the player health</span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp; Health = 100; </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p>Now that we have initialized the player by setting base values associated with the player object, we can now use these to Draw the player on the screen using the position and the graphic (Texture2D). To draw the graphic we must draw the sprite (asset) by queuing Texture for rendering. We'll do this by passing our graphic (texture) to SpriteBatch object within the Draw method. Change the Draw() method inside the Player class by adding the code below and changing the method by adding the parameter of a SpriteBatch. Please see the following code:</p>
<p style="background: #daeef3;"><span style="color: blue; font-family: Consolas; font-size: 9pt;">public<span style="color: black;"> <span style="color: blue;">void<span style="color: black;"> Draw(<span style="color: #2b91af;">SpriteBatch<span style="color: black;"> spriteBatch) </span></span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> { </span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp; spriteBatch.Draw(PlayerTexture, Position, <span style="color: blue;">null<span style="color: black;">, <span style="color: #2b91af;">Color<span style="color: black;">.White, 0f, <span style="color: #2b91af;">Vector2<span style="color: black;">.Zero, 1f, </span></span></span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #2b91af;">SpriteEffects<span style="color: black;">.None, 0f); </span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;"> }</span></p>
<p>We have now defined what a "Player" at a very basic level by creating a class that has all the data and methods needed to create a Shooter player. The next step will be to create a Player object in the context of the Game loop in order to utilize the player object as a Shooter in the game.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 14pt;">Step 2 &ndash; Instantiate the Player object in Main Game class </span></p>
<p>Switch over to Game1.cs by double-clicking "Game1.cs" in the Solution Explorer. Game1.cs is a very important code file - it is already partially filled out, as you will see. This code is our <em>game loop</em>. We're going to be making some additions to this file to make the <strong>Player</strong> class we've created part of the game loop. When we do this, it will then start to draw on the screen, every frame. Start at the top of the code, and underneath the <span style="color: #4f81bd;">using </span><strong>Microsoft.Xna.Framework.Graphics</strong>, add the following namespace:</p>
<p style="background: #daeef3;"><span style="color: blue;"><span style="font-family: Consolas; font-size: 9pt;">using<span style="color: black;"> Shooter;</span></span> </span></p>
<p>&nbsp;</p>
<p>Continue down and find the string marked <strong>public class Game1 : Game</strong>. A few lines down, below <strong>SpriteBatch _spriteBatch</strong>, add these lines:&nbsp;</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Represents the player </span></p>
<p style="background: #daeef3;"><span style="color: #2b91af;"><span style="font-family: Consolas; font-size: 9pt;">Player<span style="color: black;"> player;</span></span> </span></p>
<p>&nbsp;</p>
<p>Look down the code, find the method called <strong>protected override void Initialize().</strong> Inside that method, underneath the TODO comment, add these lines:&nbsp;</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Initialize the player class</span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Player<span style="color: black;">(); </span></span></span></span></span></p>
<p>&nbsp;</p>
<p>Next, we have to load the player graphic and set the player's initial position before we can draw them on the screen. This is where we'll call the <strong>Initialize</strong> method of our Player class. Since this involves loading a graphic from disk, we will do this inside the game loop's <strong>LoadContent()</strong> method. Look down the code, find the method called <strong>protected override void LoadContent()</strong>. Inside that method, below the <strong>SpriteBatch </strong>assignment operator and the TODO comment, add these lines:&nbsp;</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Load the player resources </span></p>
<p style="background: #daeef3;"><span style="color: #2b91af; font-family: Consolas; font-size: 9pt;">Vector2<span style="color: black;"> playerPosition = <span style="color: blue;">new<span style="color: black;"> <span style="color: #2b91af;">Vector2<span style="color: black;">(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); </span></span></span></span></span></span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Initialize(Content.Load&lt;<span style="color: #2b91af;">Texture2D<span style="color: black;">&gt;(<span style="color: #a31515;">"Graphics\\player"<span style="color: black;">), playerPosition); </span></span></span></span></span></p>
<p>&nbsp;</p>
<p>We are ready to draw our player. Any time you draw something, you'll draw it via the game loop's Draw() method. Look down the code, find the method called <strong>protected override void Draw(GameTime gameTime).</strong> Inside that method, below <strong>GraphicsDevice.Clear(Color.CornflowerBlue) </strong>and the TODO comment<strong>;</strong> add these lines:&nbsp;</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Start drawing</span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">_spriteBatch.Begin(); </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Draw the Player</span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">player.Draw(_spriteBatch); </span></p>
<p style="background: #daeef3;">&nbsp;</p>
<p style="background: #daeef3;"><span style="color: green; font-family: Consolas; font-size: 9pt;">// Stop drawing</span></p>
<p style="background: #daeef3;"><span style="color: black; font-family: Consolas; font-size: 9pt;">_spriteBatch.End(); </span></p>
<p>&nbsp;</p>
<p>We have now completed the code to draw/render the player object. Please review the <strong>Begin()</strong> and <strong>End()</strong> function calls, and note that any additional drawing and/or rending of objects will be added and completed between the <strong>Begin()</strong> and <strong>End()</strong> functions.</p>
<p>Let's draw the player on the screen. Add a folder to the Win8ShooterGame project called <strong>Content</strong>, then add a folder underneath the <strong>Content</strong> folder called <strong>Graphics</strong>. Download the precompiled shooter graphic, <strong>player.xnb</strong>, from the following link: <a href="http://sdrv.ms/Rmc11V">http://sdrv.ms/Rmc11V</a> to your computer. Right click the <strong>Graphics</strong> folder within the project and select the menu option to Add an Existing item. Add the <strong>player.xnb</strong> file from the location you saved the file on your computer.&nbsp; Now we need to set the properties for this graphic.&nbsp; Right click the newly added file, <strong>player.xnb</strong>.&nbsp; Under the Properties option, set <strong>Build Action to </strong>property to <strong>Content</strong> and <strong>Copy to Output Directory </strong>property to <strong>Copy Always.</strong></p>
<p>&nbsp;</p>
<p>Now build and run your game by either via selecting Local Device or and the Windows Simulator via Build option. If successful, you will see the Cornflower Blue background with the Ship (player) shown on the screen.</p>
<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/2211.121112_0428_Windows8Gam2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/2211.121112_5F00_0428_5F00_Windows8Gam2.png" alt="" align="left" /></p>
<p><strong>Figure 1</strong> <em>Ship/Player Drawn on the Screen </em></p>
<p>&nbsp;</p>
<p>You now have created your Shooter player and displayed it on the screen. In this walkthrough, I provided a compiled player.xnb graphic in order to display the player on the screen. In&nbsp;<strong><a title="Part 3" href="http://blogs.msdn.com/b/tarawalker/archive/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame.aspx">Part 3</a></strong>&nbsp;of this series, we remove the precompiled player graphic and walkthrough how add graphics and sound for the Shooter game by building a Content Pipeline using Visual Studio 2012 / Visual Studio 2010 using the XNA SDK for XBOX or Windows Phone. We then will compile the Content Pipeline and show how to add the graphics resources created from the XNA Content Pipeline to the MonoGame Shooter project.</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows 8 Game Development using C#, XNA and MonoGame 3.0: Building a Shooter Game Walkthrough – Part 1: Overview, Installation, MonoGame 3.0 Project Creation</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-1-overview-installation-monogame-3-0-project-creation</link>
      <pubDate>Tue, 04 Dec 2012 18:09:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2012/12/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-1-overview-installation-monogame-3-0-project-creation/</guid>
      <description><![CDATA[Overview 
Casual game developers have been using XNA since 2004 for ease of create games for...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #17365d; font-size: 20pt;">Overview </span></p>
<p>Casual game developers have been using XNA since 2004 for ease of create games for Windows, XBOX and most recently Windows Phone. XNA is a .NET framework for game development providing a content pipeline and load functionality for game asset, animation, math, sound and user input tracking via gamepad, mouse, keyboard and touch with game logic organized in a straightforward game loop architecture.</p>
<p>Game development is not trivial undertaking and XNA was a great framework to start down the path for a great number of novice game developers and/or students and developers who wanted to learn how to create quality game applications. XNA along with Visual Studio made it as easy as File &ndash;&gt; New &ndash;&gt; XNA Game Studio Project and you were off and running.</p>
<p><a href="http://monogame.codeplex.com/">MonoGame</a> is an open source cross platform implementation of the XNA namespace and class model. The goal of MonoGame is to provide XNA developers with a framework to build applications that will run on Xbox 360, Windows, Windows 8, and Windows Phone while providing the ability to port the game using the same C #codebase to run natively on the iOS, Android, Mac OS X, and Linux platform with minimal effort. With these goals in mind, the MonoGame motto therefore is to "Write Once, Play Everywhere". The technologies that make the MonoGame API cross-platform power possible are:</p>
<ul>
<li>OpenTK - a low-level C# library that wraps OpenGL, OpenCL and OpenAL for 3D graphics.</li>
<li>SharpDX - an open-source implementation of the full DirectX API for .NET which allows for development of high performance games, 2D and 3D graphics rendering, and real-time sound</li>
<li>
<div>Lidgren.Network - a networking library for .NET framework which uses an UDP socket to provide an API for connecting a client to a server, as well as, reading and sending messages</div>
<p style="margin-left: 36pt;">&nbsp;</p>
</li>
</ul>
<p>The game you will be making in this walkthrough is using the MSDN Shooter tutorial. Shooter is a particular type of game with a set of well-defined limits around what it does when the user interacts with it. This tutorial is a good starting point for learning game development with XNA and publishing a game running on Windows 8 platform using XNA leveraging MonoGame. In addition to leveraging this technology for Windows 8, you can use the MonoGame technology for native cross-platform development with other mobile platforms.</p>
<p>&nbsp;</p>
<p><span style="color: #17365d; font-size: 20pt;">Setting Up Your Development Environment </span></p>
<p>Before you can write games for Windows 8 using MonoGame, you mush setup your enviroment and your IDE to do so. I have outlined the steps below for getting your environment created. Please follow and perform the following steps in the order stated to successfully prepare your computer for XNA Development with MonoGame:</p>
<ol>
<li>
<div style="text-align: justify;"><strong>Install Microsoft Windows 8. </strong></div>
</li>
<li>
<div style="text-align: justify;"><strong>Install Games for Windows </strong></div>
<ol>
<li>
<div style="text-align: justify;"><a href="http://www.xbox.com/en-US/LIVE/PC/DownloadClient">http://www.xbox.com/en-US/LIVE/PC/DownloadClient</a></div>
</li>
</ol></li>
<li>
<div style="text-align: justify;"><strong>Install Windows Phone 8 SDK or Visual Studio 2010 Express for Windows Phone </strong></div>
<p style="text-align: justify;">Why do I need Visual Studio 2010? There is a feature of XNA called the Content Pipeline, a pre-compiler step in the preparation of graphic and audio assets for use at runtime in XNA. This feature is not implemented in MonoGame. You can leverage VS 2010 or VS 2012 with the Windows Phone SDK installed to leverege the XNA Framework template to compile the graphics into the .xnb files to include in your Windows 8 project.</p>
<ol>
<li>
<div style="text-align: justify;">Windows Phone 8 SDK: <a href="http://go.microsoft.com/fwlink/?LinkId=265772">http://go.microsoft.com/fwlink/?LinkId=265772</a></div>
</li>
<li>
<div style="text-align: justify;">Visual Studio 2010 Express for Windows Phone: <a href="http://go.microsoft.com/fwlink/?LinkId=258412">http://go.microsoft.com/fwlink/?LinkId=258412</a></div>
</li>
</ol></li>
<li>
<div style="text-align: justify;"><strong>Install Visual Studio 2012 for Windows 8 </strong></div>
<ol>
<li>
<div style="text-align: justify;">Visual Studio 2012 Express: <a href="http://bit.ly/QvLWLX">http://bit.ly/QvLWLX</a></div>
<p style="text-align: justify;"><strong>OR </strong></p>
</li>
<li>
<div style="text-align: justify;">Visual Studio 2012 Pro/Premium/Ultimate: Use DreamSpark, MSDN or your licensed copy</div>
</li>
</ol></li>
<li>
<div style="text-align: justify;"><strong>Install MonoGame 3.0 binaries, templates, and dependencies with Windows Installer: </strong></div>
<p style="text-align: justify;">Leverage the new MonoGame 3.0 Windows Installer to install the MonoGame and SharpDX libraries needed to create an XNA 4.0 project for Windows 8. This will also install two MonoGame templates for use within Visual Studio to start an XNA/MonoGame project.</p>
<ol>
<li>
<div style="text-align: justify;"><a href="http://monogame.codeplex.com/downloads/get/511666">http://monogame.codeplex.com/downloads/get/511666</a></div>
</li>
</ol></li>
<li>
<div style="text-align: justify;"><strong><span style="color: #0070c0;">Optional</span>: Install GitHub </strong></div>
<p style="text-align: justify;">If you want to review the MonoGame Source Code or contribute code to the MonoGame project.</p>
<ol>
<li>
<div style="text-align: justify;">Create a Git Account: <a href="https://github.com/">https://github.com/</a></div>
</li>
<li>
<div style="text-align: justify;">Install the GitHub Windows Client: <a href="http://windows.github.com/">http://windows.github.com/</a></div>
</li>
</ol></li>
</ol>
<p style="text-align: justify;">&nbsp;</p>
<p><span style="color: #17365d; font-size: 20pt;">Create a MonoGame project </span></p>
<p>Windows 8 is designed to run on a variety of devices, including tablets and other devices that, through the aid of on-board sensors, know whether they are in landscape mode or portrait mode. XNA Game Studio 4.0 Refresh is a programming environment that allows you to use Visual Studio to create games for Windows Phone, Xbox 360, and Windows. XNA Game Studio includes the XNA Framework, a set of managed libraries designed for game development based on the Microsoft .NET Framework. In order to leverage the power of XNA for Windows 8 since it is not supported natively, we will leverage the MonoGame framework.</p>
<p><span style="color: #17365d; font-size: 14pt;">Step 1 - Create a MonoGame project and set references </span></p>
<p>Open Visual Studio 2012 and select New Project. Under Templates, select Visual C#, you should see the MonoGame project templates listed. Select the MonoGame Game (XAML). Name the project <strong>Win8ShooterGame</strong> and ensure that the option to <strong>Create</strong> directory for solution is checked/selected.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/2480.120512_0209_Windows8Gam1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/2480.120512_5F00_0209_5F00_Windows8Gam1.png" alt="" align="left" /></p>
<p><strong>Figure 1</strong> - <em>Visual Studio with MonoGame Templates</em></p>
<p><span style="color: #17365d; font-size: 14pt;">Step 2 - Set a MonoGame references (Optional) </span></p>
<p><strong><em>**Follow these Steps ONLY if you Installed MonoGame Directly from GitHub or have problems with Template pointing to correct MonoGame references. If you installed via the MonoGame Installer, please skip to Step 3. ** </em></strong></p>
<ul>
<li>
<div>Now we need to ensure that the Solution has the correct references to the MonoGame Framework and its dependencies. Right click on your solution in the Visual Studio Solution Explorer and select Add, Existing Project.<strong><em> </em></strong></div>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/7840.120512_0209_Windows8Gam2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/7840.120512_5F00_0209_5F00_Windows8Gam2.png" alt="" align="left" /><strong>Figure 2 - </strong><em>Add Existing project to Solution </em></p>
<p>&nbsp;</p>
<p>Browse to in Explorer to <strong>C:\Users<em>\[you]</em>\Documents\GitHub\MonoGame</strong>. Select the folder named MonoGame.Framework. In this folder, you will find the MonoGame Windows 8 CSPROJ project file in this directory: <strong>C:\Users<em>\[you]</em>\Documents\GitHub\MonoGame\MonoGame.Framework\MonoGame.Framework.Windows8.csproj</strong>. <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/4201.120512_0209_Windows8Gam3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/4201.120512_5F00_0209_5F00_Windows8Gam3.png" alt="" align="left" />Select this project and click Open.</p>
</li>
</ul>
<p><strong>Figure 3 </strong><em>Add MonoGame Framework for Windows 8 project to Solution </em></p>
<p>Once the project has been added to the Visual Studio solution, right click on the MonoGame.Framework.Windows8 project, and select Clean. Then right click on the project again, and select Build. You may see a few warnings once you build the project, but that is okay.</p>
<p>Now select the Win8ShooterGame solution, select <strong>References</strong>, right click and select Add Reference. In the Reference Manager, we need to add the reference to the MonoGame.Framework into the Windows 8 project by selecting <strong>Solution</strong> and then <strong>Projects</strong>. Select the checkbox beside the MonoGame.Framework project. Click OK (Figure 4). Then again go back into Reference Manager and add the MonoGame Framework Dependencies by selecting Browse. Browse to location: <strong>C:\Users\<em>[user]\</em>Documents\GitHub\MonoGame\ThirdParty\Libs\SharpDX\Windows 8 Metro</strong> and select all of the .dll <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/3124.120512_0209_Windows8Gam4.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/3124.120512_5F00_0209_5F00_Windows8Gam4.png" alt="" align="left" />files within the folder.</p>
<p>&nbsp;</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/5353.120512_0209_Windows8Gam5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/5353.120512_5F00_0209_5F00_Windows8Gam5.png" alt="" align="left" /><strong> </strong></p>
<p>&nbsp;<strong>Figure 4 </strong><em>Add MonoGame Framework and SharpDX reference </em></p>
<p>&nbsp;</p>
<p>Finally, select the Win8ShooterGame and right click. Select Project Dependencies and select the checkbox next to MonoGame.Framework.Windows8. Click Okay and Rebuild the Entire Solution. You may get warnings, but if you have followed the steps correctly, there should be no errors.</p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/6254.120512_0209_Windows8Gam6.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/6254.120512_5F00_0209_5F00_Windows8Gam6.png" alt="" align="left" /></p>
<ul>
<li><strong></strong>&nbsp;</li>
</ul>
<p><strong></strong>&nbsp;</p>
<p>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong></strong>&nbsp;</p>
<p><strong><strong></strong></strong>&nbsp;</p>
<p><strong><strong></strong></strong>&nbsp;</p>
<p><strong>Figure&nbsp;5 </strong><em>Add MonoGame Framework Project Dependency </em></p>
<p>&nbsp;</p>
<p>&nbsp;<span style="color: #17365d; font-size: 14pt;">Step 3 - Test MonoGame Environment </span></p>
<p>Now, let's test to see if your MonoGame environment is set up correctly by running the application either via Local Device or and via the Windows Simulator. If your setup was successful, you will see the Cornflower Blue background commonly created <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/8802.120512_0209_Windows8Gam7.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/8802.120512_5F00_0209_5F00_Windows8Gam7.png" alt="" align="left" />by default with the XNA Framework projects.</p>
<p>&nbsp;You are now ready to start building your Windows 8 game. In <strong>Part 2</strong> of this series, we will add the first asset to be used in your Windows 8 Game, a player object. The player which will be represented as a spaceship will be the primary source of control for the first player shooter game. In <a title="Part 2" href="http://blogs.msdn.com/b/tarawalker/archive/2012/12/10/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-2-creating-the-shooter-player-asset-of-the-game.aspx">Part 2</a>, we will create and build a player class object to represent the actions and properties associated with the spaceship for the game.</p>]]></content:encoded>
    </item>
    <item>
      <title>Get Appy: The Windows Store is Open For Developers</title>
      <link>https://docs.microsoft.com/archive/blogs/tarawalker/get-appy-the-windows-store-is-open-for-developers</link>
      <pubDate>Thu, 13 Sep 2012 20:17:00 GMT</pubDate>
      <dc:creator><![CDATA[T E W]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/tarawalker/2012/09/13/get-appy-the-windows-store-is-open-for-developers/</guid>
      <description><![CDATA[Are you ready for the good news? Ready to Get Appy?&#160;   Well here it is, the Windows Store is...]]></description>
      <content:encoded><![CDATA[<p align="left"><font size="3" face="Segoe UI Light">Are you ready for the good news? Ready to Get Appy?&#160; </font></p>  <p align="left"><font size="3" face="Segoe UI Light">Well here it is, the Windows Store is open for Developers and we’re all anxious to see all the cool apps you develop and place into the store!&#160; What’s even more exciting is that all </font><a href="https://msdn.microsoft.com/en-us/subscriptions/buy/buy.aspx"><font size="3" face="Segoe UI Light">eligible MSDN subscribers</font></a><font size="3" face="Segoe UI Light"> receive a free, one-year Windows Store developer account as part of their MSDN benefits. (Eligible subscriptions include Visual Studio Professional, Test Professional, Premium, Ultimate, and BizSpark.) We have a program for students—</font><a href="https://www.dreamspark.com/"><font size="3" face="Segoe UI Light">DreamSpark</font></a><font size="3" face="Segoe UI Light">—that similarly waives the </font><font size="3" face="Segoe UI Light">subscription fee. And we have an offer for <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/8741.Make-great-Windows-Store-apps_4693A9B9.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/8741.Make_2D00_great_2D00_Windows_2D00_Store_2D00_apps_5F00_4693A9B9.jpg"><img style="float: right; display: inline; background-image: none;" title="Make great Windows Store apps" border="0" alt="Make great Windows Store apps" align="right" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/02/00/metablogapi/0003.Make-great-Windows-Store-apps_thumb_6C895A0F.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-02-00-metablogapi/0003.Make_2D00_great_2D00_Windows_2D00_Store_2D00_apps_5F00_thumb_5F00_6C895A0F.jpg" width="244" height="140" /></a>businesses in our </font><a href="http://www.bizspark.com/about"><font size="3" face="Segoe UI Light">BizSpark</font></a><font size="3" face="Segoe UI Light"> program, as well. </font></p>  <p><font size="3" face="Segoe UI Light">So by now, I know you’re excited and ready to get started…let me help you in the right direction.&#160; Once you get the </font><a href="http://msdn.microsoft.com/en-US/windows/apps/br229516.aspx" target="_blank"><font size="3" face="Segoe UI Light">Windows 8 OS and the Visual Studio 2012 tools from MSDN</font></a><font size="3" face="Segoe UI Light"> and/or DreamSpark (*premium for OS), to get started and on your way to having an Windows 8 developed in 30 Days try <strong><font color="#0000ff">Generation App</font></strong>: </font></p>  <p><font size="3" face="Segoe UI Light"><strong>YOUR IDEA.&#160; YOUR APP. 30 DAYS.</strong></font></p>  <p><font size="3" face="Segoe UI Light"><font color="#0000ff"><strong>Generation App</strong></font> can help you develop an app in <strong>30 days</strong>.&#160; Leverage the 30 to launch program, to spur your app development or as a precursor to the Microsoft Developer Camps and appLabs.&#160; With technical and design support offered, it’s the best way to get on your way to completing your OWN app and getting it into the Windows Store.&#160; </font></p>  <p><font size="3" face="Segoe UI Light">• <strong>Generation App -&gt; 30 Days to a Windows 8 app: </strong></font><a href="http://bit.ly/RhnDfx"><font size="3" face="Segoe UI Light"><strong>http</strong></font></a><a href="http://bit.ly/RhnDfx"><font size="3" face="Segoe UI Light"><strong>://</strong></font></a><a href="http://bit.ly/RhnDfx"><font size="3" face="Segoe UI Light"><strong>bit.ly/RhnDfx</strong></font></a></p>  <p><font size="3" face="Segoe UI Light"><strong>• Generation App -&gt; 30 Days to a Windows Phone app: </strong></font><a href="http://bit.ly/OqhP6V"><font size="3" face="Segoe UI Light"><strong>http://</strong></font></a><a href="http://bit.ly/OqhP6V"><font size="3" face="Segoe UI Light"><strong>bit.ly/OqhP6V</strong></font></a></p>  <p><font size="3" face="Segoe UI Light"><strong>• Generation App -&gt; Home Page: </strong></font><a href="http://bit.ly/Rho21y"><font size="3" face="Segoe UI Light"><strong>http://bit.ly/Rho21y</strong></font></a></p>  <p><font size="3" face="Segoe UI Light">Happy Coding!</font></p>]]></content:encoded>
    </item>
  </channel>
</rss>