<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>If broken it is, fix it you should</title><link>http://blogs.msdn.com/b/tess/</link><description>Using the powers of the debugger to solve the problems of the world - and a bag of chips
&amp;nbsp;&amp;nbsp;&amp;nbsp;by Tess Ferrandez, ASP.NET Escalation Engineer (Microsoft)
</description><dc:language>sv-SE</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Displaying HTML Content in a RichTextBlock</title><link>http://blogs.msdn.com/b/tess/archive/2013/05/13/displaying-html-content-in-a-richtextblock.aspx</link><pubDate>Mon, 13 May 2013 07:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10418026</guid><dc:creator>Tess1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10418026</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2013/05/13/displaying-html-content-in-a-richtextblock.aspx#comments</comments><description>&lt;pre class="csharpcode"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;[This post is a part of a series of posts about the &lt;strong&gt;Social Media Dashboard Sample&lt;/strong&gt;.&amp;nbsp; For an introductory blog post with information and links to the Social Media Dashboard sample click &lt;a href="http://blogs.msdn.com/b/thunbrynt/archive/2013/04/12/introduction-to-the-social-media-dashboard-sample.aspx"&gt;here&lt;/a&gt;] &lt;br /&gt; &lt;br /&gt;When you want to display HTML content from a blog RSS feed or other sources in a Windows 8 app you can display this in a WebView but the problem with the WebWiew is that you can&amp;rsquo;t use your own background or disable zooming which means that you will have a rather crude UX experience.&lt;/p&gt;
&lt;p&gt;One thing you can do is inject CSS but if you want to have more control over the content you can display it in a RichTextBlock instead.&lt;/p&gt;
&lt;p&gt;The RichTextBlock control doesn&amp;rsquo;t display HTML as is, so in the &lt;a href="http://code.msdn.microsoft.com/windowsapps/Social-Media-Dashboard-135436da"&gt;Social Media Dashboard Sample&lt;/a&gt; we parse the HTML and add native Windows 8 controls to the RichTextBlock.&lt;/p&gt;
&lt;h2&gt;Defining the Properties.Html Dependency Property&lt;/h2&gt;
&lt;p&gt;On the ScrollingBlogPostDetailPage.xaml we add a RichTexBlock and databind the HTML content to the rtbx:Properties.Html property like this&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;RichTextBlock&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;="textContent"&lt;/span&gt; &lt;span class="attr"&gt;FontSize&lt;/span&gt;&lt;span class="kwrd"&gt;="16"&lt;/span&gt; &lt;span class="attr"&gt;IsTextSelectionEnabled&lt;/span&gt;&lt;span class="kwrd"&gt;="True"&lt;/span&gt; &lt;span class="attr"&gt;FontFamily&lt;/span&gt;&lt;span class="kwrd"&gt;="Segoe UI"&lt;/span&gt; 
&lt;span class="attr"&gt;Foreground&lt;/span&gt;&lt;span class="kwrd"&gt;="{StaticResource AppDarkColor}"&lt;/span&gt; &lt;span class="attr"&gt;rtbx:Properties&lt;/span&gt;.&lt;span class="attr"&gt;Html&lt;/span&gt;&lt;span class="kwrd"&gt;="{Binding Content}"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order for this to work we need to create the extension property Html separately and that is where we parse the content and build the Control tree.&lt;/p&gt;
&lt;p&gt;The xml namespace rtbx in the sample above is defined as mlns:rtbx="using: SocialMediaDashboard.Common"where SocialMediaDashboard.Common is where we define the Properties class.&lt;/p&gt;
&lt;p&gt;The properties class has a property Html, and when this property is set, the HtmlChanged method is called&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; DependencyProperty HtmlProperty =
DependencyProperty.RegisterAttached(&lt;span class="str"&gt;"Html"&lt;/span&gt;, &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;), &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(Properties), &lt;span class="kwrd"&gt;new&lt;/span&gt; PropertyMetadata(&lt;span class="kwrd"&gt;null&lt;/span&gt;, HtmlChanged));
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The HtmlChanged method captures the HTML, generates the various blocks used in the RichTextBlock and adds them to the RichTextBlock Control&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; HtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RichTextBlock richText = d &lt;span class="kwrd"&gt;as&lt;/span&gt; RichTextBlock;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (richText == &lt;span class="kwrd"&gt;null&lt;/span&gt;) &lt;span class="kwrd"&gt;return&lt;/span&gt;;

            &lt;span class="rem"&gt;//Generate blocks&lt;/span&gt;
            &lt;span class="kwrd"&gt;string&lt;/span&gt; xhtml = e.NewValue &lt;span class="kwrd"&gt;as&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;;

            &lt;span class="kwrd"&gt;string&lt;/span&gt; baselink = &lt;span class="str"&gt;""&lt;/span&gt;;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (richText.DataContext &lt;span class="kwrd"&gt;is&lt;/span&gt; BlogPostDataItem)
            {
                BlogPostDataItem bp = richText.DataContext &lt;span class="kwrd"&gt;as&lt;/span&gt; BlogPostDataItem;
                baselink = &lt;span class="str"&gt;"http://"&lt;/span&gt; + bp.Link.Host;
            }

            List&amp;lt;Block&amp;gt; blocks = GenerateBlocksForHtml(xhtml, baselink);

            &lt;span class="rem"&gt;//Add the blocks to the RichTextBlock&lt;/span&gt;
            richText.Blocks.Clear();
            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Block b &lt;span class="kwrd"&gt;in&lt;/span&gt; blocks)
            {
                richText.Blocks.Add(b);
            }
        }
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It also performs a few more housekeeping functions like getting a base link that we can use to generate absolute links for images as many bloggers tend to just use relative links. Because we know in this app that we will always be databound to a BlogPostDataItem we can use the link from there.&lt;/p&gt;
&lt;p&gt;The method &lt;strong&gt;GenerateBlocksForHtml&lt;/strong&gt; is where we start the parsing and this will eventually generate all the blocks we need to add to the RichTextBlock.&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; List&amp;lt;Block&amp;gt; GenerateBlocksForHtml(&lt;span class="kwrd"&gt;string&lt;/span&gt; xhtml, &lt;span class="kwrd"&gt;string&lt;/span&gt; baselink)
        {
            List&amp;lt;Block&amp;gt; bc = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Block&amp;gt;();

            &lt;span class="kwrd"&gt;try&lt;/span&gt;
            {
                HtmlDocument doc = &lt;span class="kwrd"&gt;new&lt;/span&gt; HtmlDocument();
                doc.LoadHtml(xhtml);

                &lt;span class="kwrd"&gt;foreach&lt;/span&gt;(HtmlNode img &lt;span class="kwrd"&gt;in&lt;/span&gt; doc.DocumentNode.Descendants(&lt;span class="str"&gt;"img"&lt;/span&gt;)){
                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!img.Attributes[&lt;span class="str"&gt;"src"&lt;/span&gt;].Value.StartsWith(&lt;span class="str"&gt;"http"&lt;/span&gt;))
                    {
                        img.Attributes[&lt;span class="str"&gt;"src"&lt;/span&gt;].Value = baselink + img.Attributes[&lt;span class="str"&gt;"src"&lt;/span&gt;].Value;
                    }
                }

                Block b = GenerateParagraph(doc.DocumentNode);
                bc.Add(b);
            }
            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)
            {
            }

            &lt;span class="kwrd"&gt;return&lt;/span&gt; bc;
        }
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In here we generate the starter block (a paragraph block) that contains all other blocks, and the GenerateParagraph method goes through the content of the HTML root node and adds blocks to this one base paragraph Control.&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Block GenerateParagraph(HtmlNode node)
        {
            Paragraph p = &lt;span class="kwrd"&gt;new&lt;/span&gt; Paragraph();
            AddChildren(p, node);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; p;
        }
&lt;/pre&gt;
&lt;p&gt;We then go through and add Inline elements for all the children of the root HTML node. This method is later called recursively until we get to the leaf HTML node&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddChildren(Paragraph p, HtmlNode node)
        {
            &lt;span class="kwrd"&gt;bool&lt;/span&gt; added = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (HtmlNode child &lt;span class="kwrd"&gt;in&lt;/span&gt; node.ChildNodes)
            {
                Inline i = GenerateBlockForNode(child);
                &lt;span class="kwrd"&gt;if&lt;/span&gt; (i != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
                {
                    p.Inlines.Add(i);
                    added = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
                }
            }
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!added)
            {
                p.Inlines.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Run() { Text = CleanText(node.InnerText) });
            }
        }
&lt;/pre&gt;
&lt;pre class="csharpcode"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;Depending on the type of the node we either generate a Span, Linebreak, Hyperlink, or Paragraph with Image etc. or combinations thereof and then continue adding the children as new Inlines. Part of the GenerateBlocksForNode method is shown below&amp;hellip; for the full code look in RichTextBlockProperties.cs file in the SocialMediaDashboard sample&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Inline GenerateBlockForNode(HtmlNode node)
        {
            &lt;span class="kwrd"&gt;switch&lt;/span&gt; (node.Name)
            {
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"div"&lt;/span&gt;:
                    &lt;span class="kwrd"&gt;return&lt;/span&gt; GenerateSpan(node);
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"p"&lt;/span&gt;:
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"P"&lt;/span&gt;:
                    &lt;span class="kwrd"&gt;return&lt;/span&gt; GenerateInnerParagraph(node);
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"img"&lt;/span&gt;:
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"IMG"&lt;/span&gt;:
                    &lt;span class="kwrd"&gt;return&lt;/span&gt; GenerateImage(node);
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"a"&lt;/span&gt;:
                &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;"A"&lt;/span&gt;:
                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (node.ChildNodes.Count &amp;gt;= 1 &amp;amp;&amp;amp; (node.FirstChild.Name == &lt;span class="str"&gt;"img"&lt;/span&gt; || node.FirstChild.Name == &lt;span class="str"&gt;"IMG"&lt;/span&gt;))
                        &lt;span class="kwrd"&gt;return&lt;/span&gt; GenerateImage(node.FirstChild);
                    &lt;span class="kwrd"&gt;else&lt;/span&gt;
                        &lt;span class="kwrd"&gt;return&lt;/span&gt; GenerateHyperLink(node);
                    &amp;hellip;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;GenerateSpan looks like this for example&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Inline GenerateSpan(HtmlNode node)
        {
            Span s = &lt;span class="kwrd"&gt;new&lt;/span&gt; Span();
            AddChildren(s, node);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; s;
        }
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;HTML is obviously a pretty rich markup language and it would take forever to write code to parse and display all types of elements so this sample just implements the most common ones but as it turns out it still captures most of the elements used in the blog posts that we have encountered so far, and the model used here is pretty easy to expand for the specific situations you might encounter.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For more information about Windows 8 app development, go &lt;a href="http://msdn.microsoft.com/en-US/windows/apps/"&gt;here&lt;/a&gt;. &lt;br /&gt;For more information about Windows Phone development, go &lt;a href="http://dev.windowsphone.com/en-us"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10418026" width="1" height="1"&gt;</description></item><item><title>Great Swedish games in the Windows 8 store and the Windows Phone Store</title><link>http://blogs.msdn.com/b/tess/archive/2013/04/03/great-swedish-games-in-the-windows-8-store-and-the-windows-phone-store.aspx</link><pubDate>Wed, 03 Apr 2013 12:41:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10407221</guid><dc:creator>Tess1</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10407221</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2013/04/03/great-swedish-games-in-the-windows-8-store-and-the-windows-phone-store.aspx#comments</comments><description>&lt;p&gt;Lately I have been focusing a lot on games and education apps and I have been working with a lot of great Swedish game developers so I think it’s about time I gave them a shout out.&lt;/p&gt;  &lt;p&gt;This is by no means a complete list of Swedish games in the store but just some that I want to recommend.&amp;#160; Click on the Pictures to get to the store and try them out&lt;/p&gt;  &lt;p&gt;Ahh, but first a quick message about a Swedish Competition… We are running &lt;a href="http://www.microsoft.com/sverige/msdn/devdestination/devbattle/index.html"&gt;dev.battle&lt;/a&gt; where you can win a Nokia Lumia 820 or an Acer Iconia W510 if you create apps and games for Windows 8 and Windows Phone.&lt;/p&gt;  &lt;p&gt;I have an Acer Iconia W510 on loan now from work and I didn’t think it was going to WOW me but I was very wrong.&amp;#160; Since I got it home I have only been able to use it once my daughter goes to bed because she completely hogs it.&amp;#160; It’s in that sweet spot where it is a great tablet but also has a full keyboard, and full Windows 8… it doesn’t really hurt that we only need to charge it every 3-4 days since it has around 10 hrs of battery in the tablet and another 10 in the keyboard.&amp;#160; I wouldn’t use it for Visual Studio or hard core gaming but it definitely fits my needs for surfing and doing regular “in front of the TV” casual gaming.&amp;#160; &lt;/p&gt;  &lt;h1&gt;My Favorite Swedish Games in the Windows 8 store&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7028.image_5F00_2CA75B3F.png"&gt;&lt;img title="image" style="background-image: none; display: inline" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1667.image_5F00_thumb_5F00_7A3361F2.png" width="644" height="364" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Donut Games&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.donutgames.com/index.php?os=win8"&gt;Donut games&lt;/a&gt; is a small indie game developer company that has made it big time on other platforms with their popular series of games so I was extremely happy when they decided to take their games to Windows 8.&amp;#160; They have a very cool collectors badge idea where each game Icon has a collectors number so you can collect them all :)&lt;/p&gt;  &lt;h3&gt;Rat on a…&lt;/h3&gt;  &lt;p&gt;First we have their Rat on a… series with &lt;a href="http://apps.microsoft.com/windows/en-US/app/rat-on-a-scooter-xl/842BDAFA-58D0-478D-82FC-577F67CA65AD"&gt;Rat on a Scooter XL (17)&lt;/a&gt;, &lt;a href="http://apps.microsoft.com/windows/en-US/app/rat-on-a-skateboard/efa60ff9-7b7a-49d2-bb2a-2d237720be59"&gt;Rat on a Skateboard (24)&lt;/a&gt; and &lt;a href="http://apps.microsoft.com/windows/en-US/app/rat-on-a-snowboard/85525101-b103-401c-9e86-bb11f589078f"&gt;Rat on a Snowboard (29)&lt;/a&gt;.&amp;#160; The goal here is to run though the levels, collecting cheese and stars and do tricks with the “vehicles”.&amp;#160; The games are super easy and fun and work really well both with keyboard and touch and I love the pixel graphic they use that give the game that “arcade” feel.&amp;#160; As a special treat the Rat on a Scooter XL game is FREE, but the other ones are well worth their $1.49.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/rat-on-a-scooter-xl/842BDAFA-58D0-478D-82FC-577F67CA65AD"&gt;&lt;img title="Ratonascooterxl" style="background-image: none; display: inline" border="0" alt="Ratonascooterxl" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0268.Ratonascooterxl_5F00_0F61679B.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/rat-on-a-skateboard/efa60ff9-7b7a-49d2-bb2a-2d237720be59"&gt;&lt;img title="ratonaskateboard" style="background-image: none; display: inline" border="0" alt="ratonaskateboard" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2742.ratonaskateboard_5F00_153C0B34.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/rat-on-a-snowboard/85525101-b103-401c-9e86-bb11f589078f"&gt;&lt;img title="ratonasnowboard" style="background-image: none; display: inline" border="0" alt="ratonasnowboard" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6038.ratonasnowboard_5F00_1B16AECD.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Rat on a Skateboard was brought up as &lt;a href="http://channel9.msdn.com/Shows/Windows-Store-Weekly/Windows-Store-Weekly-Rat-on-a-Skateboard-PhotoWhirl-Hulu-Plus-Chimpact-Fresh-Paint"&gt;game of the week at Coding4Fun&lt;/a&gt; so if you don’t trust me, trust them:)&lt;/p&gt;  &lt;h3&gt;Other Donut games&lt;/h3&gt;  &lt;p&gt;In &lt;a href="http://apps.microsoft.com/windows/en-US/app/castle-smasher/d4b56c53-6846-4200-bb8d-8224f4990b51"&gt;Castle Smasher (02)&lt;/a&gt; you use a catapult to throw boulders at castles, to be honest I haven’t played this game a lot since it just came out but it looks very promising.&lt;/p&gt;  &lt;p&gt;The other game shown here is &lt;a href="http://apps.microsoft.com/windows/en-US/app/bubble-pig/77B41D16-9A47-4C90-BC4D-C9E5C73A7052"&gt;Bubble Pig (33)&lt;/a&gt; and this is one of my favorite games.&amp;#160; It has all the ingredients of a great game complete with platform jumping, collect stuff, try to beat your level scores and all that fun.&amp;#160; I have spent countless hours playing this game and would absolutely recommend it.&amp;#160; This is one of the rare games that is made first for touch but works even better with keyboard since it makes it a lot easier to get into those secret coin filled areas that you really want to access.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0268.castlesmasher_5F00_0BFFCFF3.jpg"&gt;&lt;img title="castlesmasher" style="background-image: none; display: inline" border="0" alt="castlesmasher" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3817.castlesmasher_5F00_thumb_5F00_18214A1A.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/bubble-pig/77B41D16-9A47-4C90-BC4D-C9E5C73A7052"&gt;&lt;img title="bubblepig" style="background-image: none; display: inline" border="0" alt="bubblepig" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0284.bubblepig_5F00_090A6B40.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Games from Filimundus&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.filimundus.com/main"&gt;Filimundus&lt;/a&gt; is a Swedish game developer that makes games for kids.&amp;#160; They have some amazing characters in their portfolio like the Astrid Lindgren character Pippi Longstocking, and some very popular Swedish childrens books characters like ol’ man Pettson and his cat Findus.&amp;#160; Even if you don’t know the characters the games are awesome and makes even adults have to think a lot before solving the puzzles.&lt;/p&gt;  &lt;p&gt;The games &lt;a href="http://apps.microsoft.com/windows/en-US/app/pettsons-inventions/291F38E4-4D42-423B-A235-86C9D0F48154"&gt;Pettsons Inventions 1&lt;/a&gt; and &lt;a href="http://apps.microsoft.com/windows/en-US/app/pettsons-inventions-2/f160887c-5d08-4514-8d7c-b6217fa9a4ae"&gt;Pettsons Inventions 2&lt;/a&gt; are similar but in my opinion much better than Amazing Alex and the Incredible Machine.&amp;#160; The attention to detail, the difficulty of the puzzles and the quirky things that happen are extremely well balanced.&amp;#160; These games are a must have if you have kids that are in the ages 2-10&lt;/p&gt;  &lt;p&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/pettsons-inventions/291F38E4-4D42-423B-A235-86C9D0F48154"&gt;&lt;img title="pettsonsinventions1" style="background-image: none; display: inline" border="0" alt="pettsonsinventions1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2766.pettsonsinventions1_5F00_39BD72EB.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/pettsons-inventions-2/f160887c-5d08-4514-8d7c-b6217fa9a4ae"&gt;&lt;img title="pettsonsinventions2 - Copy" style="background-image: none; display: inline" border="0" alt="pettsonsinventions2 - Copy" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1258.pettsonsinventions2_2D002D002D00_Copy_5F00_548998F7.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;IloMilo, Swedish XBOX live game made by SouthEnd Interactive&lt;/h2&gt;  &lt;p&gt;I have own this game both on Windows Phone, Windows 8 and on the XBOX.&amp;#160; On Windows 8 it is called &lt;a href="http://apps.microsoft.com/windows/en-US/app/ilomilo-plus/77b889d8-151d-48f0-a9df-21a23da36029"&gt;Ilomilo plus&lt;/a&gt; and features some additional levels.&amp;#160; It’s been out for a while now on &lt;a href="http://www.windowsphone.com/en-us/store/app/ilomilo/6d8088a0-77d6-df11-a844-00237de2db9e"&gt;Windows Phone&lt;/a&gt; but for those of you who haven’t yet played it it is a super cute puzzler where you have to guide ilo through a level, collecting flowers, extras and rescue safkas and finally meet up with milo to finish the level.&lt;/p&gt;  &lt;p&gt;Some levels are extremely hard and although I don’t like to, I have had to check the walkthroughs a couple of times to get past some of them:)&amp;#160; There is a lot of extra pretty interesting info about Ilo, Milo,&amp;#160; Sebastian and the safkas on the &lt;a href="http://blog.ilomilo.com"&gt;ilomilo blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/ilomilo-plus/77b889d8-151d-48f0-a9df-21a23da36029"&gt;&lt;img title="ilomiloplus" style="background-image: none; display: inline" border="0" alt="ilomiloplus" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3240.ilomiloplus_5F00_053CA0A3.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/ilomilo/6d8088a0-77d6-df11-a844-00237de2db9e"&gt;&lt;img title="ilomilo-logo" style="background-image: none; display: inline" border="0" alt="ilomilo-logo" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3821.ilomilo_2D00_logo_5F00_3CA2B1D1.png" width="138" height="138" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Sprinkle by Mediocre&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/sprinkle/993322fd-7a1a-4f76-bd2d-20bcb38209ad"&gt;Sprinkle&lt;/a&gt; by &lt;a href="http://www.sprinklegame.com/"&gt;Mediocre AB&lt;/a&gt; is a cute game where you use a water cannon to make your way though the levels and remove obstacles.&amp;#160; This game is a bit of an anomaly in that it is only available on Windows RT but if you are sporting a Surface RT or some other RT device this is definitely a fun game.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/sprinkle/993322fd-7a1a-4f76-bd2d-20bcb38209ad"&gt;&lt;img title="Screenshot_37378_1000000" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Screenshot_37378_1000000" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3817.Screenshot_5F00_37378_5F00_1000000_5F00_1423CFBD.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2656.sprinkle_5F00_0E68B617.jpg"&gt;&lt;img title="sprinkle" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="sprinkle" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7853.sprinkle_5F00_thumb_5F00_65E9D402.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Word and Quiz Games&lt;/h2&gt;  &lt;p&gt;Finally I’d like to call out &lt;a href="http://apps.microsoft.com/windows/sv-SE/app/quizme-for-windows-8/97D6DC96-22EE-4230-945D-90B1C7995AD0"&gt;QuizMe&lt;/a&gt;, a great quiz game from &lt;a href="http://www.facebook.com/quizmeapp"&gt;WeAreQiiWi Interactive&lt;/a&gt; where you play rounds of quiz challenges with your friends, and also the game &lt;a href="http://apps.microsoft.com/windows/en-US/app/wordroom/0C6F08CE-749A-441A-A4CE-D0B863DB0DBA"&gt;WordRoom&lt;/a&gt; from &lt;a href="http://www.facebook.com/WordRoom"&gt;IO2GameLabs&lt;/a&gt;, a Word puzzler where you have to find Words in a grid before your opponent finds them, very addictive. WordRoom is also available on &lt;a href="http://www.windowsphone.com/en-us/store/app/wordroom/9aa32050-e00c-491b-86e2-663ffdbb0ae9"&gt;Windows Phone&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://apps.microsoft.com/windows/sv-SE/app/quizme-for-windows-8/97D6DC96-22EE-4230-945D-90B1C7995AD0"&gt;&lt;img title="quizme" style="background-image: none; display: inline" border="0" alt="quizme" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6545.quizme_5F00_56D2F528.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://apps.microsoft.com/windows/en-US/app/wordroom/0C6F08CE-749A-441A-A4CE-D0B863DB0DBA"&gt;&lt;img title="wordroom" style="background-image: none; display: inline" border="0" alt="wordroom" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1777.wordroom_5F00_3C26590F.jpg" width="244" height="139" /&gt;&lt;/a&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/wordroom/9aa32050-e00c-491b-86e2-663ffdbb0ae9"&gt;&lt;img title="wordroom-s1" style="background-image: none; display: inline" border="0" alt="wordroom-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1680.wordroom_2D00_s1_5F00_0F9D2929.png" width="130" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;My Favorite Swedish Games in the Windows Phone store&lt;/h1&gt;  &lt;p&gt;Apart from IloMilo and Wordroom that I mentioned earlier there are some other great Swedish games in the Windows Phone store&lt;/p&gt;  &lt;h2&gt;Ruzzle&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/ruzzle/df974b24-24b0-47b6-a3f9-97d907befe50?ocid=TWP_RUZZLE_MKTPL"&gt;Ruzzle&lt;/a&gt; is a wordfinding game created by &lt;a href="www.facebook.com/ruzzlegame"&gt;MAG Interactive&lt;/a&gt;.&amp;#160; The game has existed for some time on IOS and Android and the game play is very similar to Wordament but with the difference that you play 3 2 minute rounds against your friends.&amp;#160; You can challenge your friends either by name, through facebook or through twitter, both if they are on Windows Phone or if they play the game on one of the other platforms. It is extremely addictive and as of lately I have been playing this a lot.&amp;#160; If you want to try to beat me, my ruzzle name is tessifufu:) I play mostly in Swedish but I’m up for a game in English as well.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/ruzzle/df974b24-24b0-47b6-a3f9-97d907befe50?ocid=TWP_RUZZLE_MKTPL"&gt;&lt;img title="ruzzle-logo" style="background-image: none; display: inline" border="0" alt="ruzzle-logo" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4722.ruzzle_2D00_logo_5F00_327DEAD9.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7450.ruzzle_2D00_s1_5F00_782274F7.png"&gt;&lt;img title="ruzzle-s1" style="background-image: none; display: inline" border="0" alt="ruzzle-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1273.ruzzle_2D00_s1_5F00_thumb_5F00_7D90E59B.png" width="130" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Cradle to the Grave (+ premium)&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/cradle-to-the-grave/859615c0-c105-4062-93cd-f93188df90e5"&gt;Cradle to the Grave&lt;/a&gt; from &lt;a href="http://coltranstudios.com/"&gt;Coltran Studios&lt;/a&gt; is a very interesting game where you battle sombies and other enemies, acumulate weapons and just have some blasting fun.&amp;#160; The game has risen on the WP charts and is now one of the most popular games on WP… it is also a bit special because it is WP exclusive.&amp;#160; It includes zombies, crafting your own weapons, awesome cartoon graphics and everything else that makes a game awesome to create that perfect game.&amp;#160; The game is available in a free and a premium version (without ads)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/cradle-to-the-grave/859615c0-c105-4062-93cd-f93188df90e5"&gt;&lt;img title="cradle-logo" style="background-image: none; display: inline" border="0" alt="cradle-logo" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7450.cradle_2D00_logo_5F00_2E43ED47.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/cradle-to-the-grave-premium/ff4fce83-ab65-40cb-b77e-422e2a18b5eb"&gt;&lt;img title="cradle-premium" style="background-image: none; display: inline" border="0" alt="cradle-premium" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6076.cradle_2D00_premium_5F00_0CE447AB.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6052.cradle_2D00_s1_5F00_40400B07.png"&gt;&lt;img title="cradle-s1" style="background-image: none; display: inline" border="0" alt="cradle-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1777.cradle_2D00_s1_5F00_thumb_5F00_05B4E566.png" width="244" height="148" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Ragdoll Run (+ premium)&lt;/h2&gt;  &lt;p&gt;What happens if you mix Temple Run with Ilomilo?&amp;#160; You get ragdoll run:)&amp;#160; This is again one of those games that have become extremely popular on WP lately both because of the addictive gameplay but also because these ragdolls are just too cute.&amp;#160; This game is created by Dawnbreak Studios and comes in a &lt;a href="http://www.windowsphone.com/en-us/store/app/ragdoll-run/88897723-a460-4810-a82f-0a7c7f7fa29a"&gt;free&lt;/a&gt; and a &lt;a href="http://www.windowsphone.com/en-us/store/app/ragdoll-run/5771f139-42ac-4725-9424-7028cde06f38"&gt;premium&lt;/a&gt; version.&amp;#160; Love Love Love this game&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5074.ragdoll_2D00_logo_5F00_31F16C4A.png"&gt;&lt;img title="ragdoll-logo" style="background-image: none; display: inline" border="0" alt="ragdoll-logo" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3733.ragdoll_2D00_logo_5F00_thumb_5F00_017AE7D4.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1273.ragdoll_2D00_s1_5F00_46B33EFD.png"&gt;&lt;img title="ragdoll-s1" style="background-image: none; display: inline" border="0" alt="ragdoll-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8524.ragdoll_2D00_s1_5F00_thumb_5F00_728392EC.png" width="244" height="148" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Blobster&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/blobster/f8a41f72-efb3-42e8-9611-ea2565c147dd"&gt;Blobster&lt;/a&gt; by &lt;a href="http://www.divinerobot.com/"&gt;Divine Robot&lt;/a&gt; is a super cute XBOX Live game where you have to move the blobster though challenging levels.&amp;#160; To move the blobster you extend him like a rubber band and fling him away.&amp;#160; Not sure why I am automatically thinking it’s a he, but anyways… again we are talking great graphics and really fun gameplay, enough for many hours of fun.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/blobster/f8a41f72-efb3-42e8-9611-ea2565c147dd"&gt;&lt;img title="blobster-logo" style="background-image: none; display: inline" border="0" alt="blobster-logo" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2251.blobster_2D00_logo_5F00_62944E28.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2251.blobster_2D00_s1_5F00_3A156C14.png"&gt;&lt;img title="blobster-s1" style="background-image: none; display: inline" border="0" alt="blobster-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5315.blobster_2D00_s1_5F00_thumb_5F00_74906BE8.png" width="244" height="148" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Duudle&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-US/store/app/duudle/4bf00a41-5e79-43e5-87c0-bbdabb42a109"&gt;Duudle&lt;/a&gt; by VISIARC has been around for ages on Windows Phone and I used to play this a lot about a year ago.&amp;#160; It has some similarities with DrawSomething but is still very different.&amp;#160; The way you play is that you set up a match with 3 or more of your friends.&amp;#160; In each round one person draws a given word and then it is up to the other players to guess what you drew.&lt;/p&gt;  &lt;p&gt;They use a very interesting way to make this work… first the drawer draws, then the turn is passed on to the guessers but it’s a turn based game so you don’t have to all be there at once.&amp;#160; Once it is your time to guess the drawing is played up in real time so you see the drawing as it happens and you have to guess quicker than the other person.&amp;#160; If you don’t guess it right you can guess again with a time penalty and scores are tallied based on how fast you guess.&amp;#160; The drawer also scores based on if the other people guessed it or not, so you have to hit the perfect combination of making it easy but not too easy.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-US/store/app/duudle/4bf00a41-5e79-43e5-87c0-bbdabb42a109"&gt;&lt;img title="duudle-icon" style="background-image: none; display: inline" border="0" alt="duudle-icon" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5481.duudle_2D00_icon_5F00_4C1189D4.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7127.duudle_2D00_s1_5F00_6A7BCABD.png"&gt;&lt;img title="duudle-s1" style="background-image: none; display: inline" border="0" alt="duudle-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1185.duudle_2D00_s1_5F00_thumb_5F00_140F95F1.png" width="244" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6471.duudle_2D00_s2_5F00_671A3315.png"&gt;&lt;img title="duudle-s2" style="background-image: none; display: inline" border="0" alt="duudle-s2" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0525.duudle_2D00_s2_5F00_thumb_5F00_10ADFE49.png" width="244" height="148" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Manic Miner and other Spectrum games&lt;/h2&gt;  &lt;p&gt;This one (&lt;a href="http://www.windowsphone.com/en-us/store/app/manic-miner/e55dfd5f-a9ab-4734-a6d4-59ecb27ea1ee"&gt;manic miner&lt;/a&gt;) I have to admit I haven’t played but I loved Spectrum so I’m recommending it anyways.&amp;#160; Elite are coming out with a number of old spectrum games now ported to Windows Phone and the connection to Sweden is that the dev is Swedish.&amp;#160; These games are sure to take you down memory lane:)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/store/app/manic-miner/e55dfd5f-a9ab-4734-a6d4-59ecb27ea1ee"&gt;&lt;img title="manic miner" style="background-image: none; display: inline" border="0" alt="manic miner" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2262.manic_2D00_miner_5F00_5FEAD0D0.png" width="148" height="148" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7043.manicminer_2D00_s1_5F00_376BEEBC.png"&gt;&lt;img title="manicminer-s1" style="background-image: none; margin: 0px; display: inline" border="0" alt="manicminer-s1" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7043.manicminer_2D00_s1_5F00_thumb_5F00_5CF56C1D.png" width="130" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;      &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Let me know what your favorites are, I’m always looking for new and fun games&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Tess&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10407221" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+8/">Windows 8</category></item><item><title>Prisjakt The Story - Writing a Windows 8 app in JavaScript/HTML</title><link>http://blogs.msdn.com/b/tess/archive/2012/05/30/prisjakt-the-story-writing-a-windows-8-app-in-javascript-html.aspx</link><pubDate>Wed, 30 May 2012 07:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10311699</guid><dc:creator>Tess1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10311699</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/05/30/prisjakt-the-story-writing-a-windows-8-app-in-javascript-html.aspx#comments</comments><description>&lt;p&gt;&lt;i&gt;[Prisjakt &amp;ndash; The Story is a series of blog posts about our experiences helping Prisjakt/PriceSpy to write a Windows 8 Metro Style App using HTML/CSS/JavaScript.]&lt;/i&gt;&lt;/p&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Prisjakt/PriceSpy is web site for searching for/comparing products and getting the best price for a product. Prisjakt/PriceSpy is currently available in four countries: Sweden, Norway, United Kingdom and New Zeeland We at Microsoft DPE in Sweden has helped them to write a Windows 8 Metro Style app. We will post a series of articles of things we learned during the development. Here&amp;rsquo;s a list of the post&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Designing the application" href="http://blogs.msdn.com/b/thunbrynt/archive/2012/05/29/prisjakt-the-story-designing-the-application.aspx"&gt;Designing the application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="Working with screen resolutions and orientations" href="http://blogs.msdn.com/b/thunbrynt/archive/2012/05/29/prisjakt-the-story-resolutions-amp-orientations.aspx"&gt;Working with screen resolutions and orientations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="Localizing your app" href="http://blogs.msdn.com/b/thunbrynt/archive/2012/05/29/prisjakt-the-story-localization.aspx"&gt;Localizing your app&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="JSON and data binding" href="http://blogs.msdn.com/b/thunbrynt/archive/2012/05/29/prisjakt-the-story-json-amp-data-binding.aspx"&gt;JSON &amp;amp; data binding&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="Implementing the search contract and deep linking" href="http://blogs.msdn.com/b/thunbrynt/archive/2012/05/30/prisjakt-the-story-search-contract-and-deep-linking.aspx"&gt;Implementing the search contract &amp;amp; deep linking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Using the Bing Maps control&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here&amp;rsquo;s a link to a short &lt;a href="http://www.youtube.com/watch?v=UinzXs1f9as&amp;amp;feature=youtu.be"&gt;demo&lt;/a&gt;&amp;nbsp;(in Swedish) that shows the main features of the app. You can find it in Windows Store near you soon!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10311699" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/JavaScript/">JavaScript</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows8/">Windows8</category></item><item><title>Bizzy Bees Step 5: Adding some bees to the mix (XNA Walkthrough)</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx</link><pubDate>Fri, 02 Mar 2012 15:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276522</guid><dc:creator>Tess1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276522</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx#comments</comments><description>&lt;p&gt;This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx"&gt;Overview&lt;/a&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1: Setting the stage (projects and assets) &lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We have two steps left before we have a fully functioning game.&amp;nbsp; We need to add some bees to match with the flowers and we need to add some user interaction to be able to match the flowers and the bees.&lt;/p&gt;
&lt;h2&gt;BeePicker and Bees&lt;/h2&gt;
&lt;p&gt;We are going to use a similar way to generate the bees as we did with the flowers.&lt;/p&gt;
&lt;p&gt;First off we have a BeePicker (the bottom area of the screen) that takes care of adding, removing and interacting with the bees&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2047.image_5F00_3912416A.png"&gt;&lt;img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0363.image_5F00_thumb_5F00_22DC2618.png" width="244" height="58" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add a new BeePicker class with the following contents&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; class&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; BeePicker&lt;/span&gt;
    {
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; beeDeltaX = 96;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; beeStartX = 5;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; beeStartY = 700;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; numberOfBeeColors = 5;

        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Bee&lt;/span&gt;&amp;gt; bees = &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; SpriteBatch&lt;/span&gt; spriteBatch;
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Texture2D&lt;/span&gt; beeMap;
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Random&lt;/span&gt; r;

        &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; BeePicker(&lt;span style="color: #2b91af;"&gt;ContentManager&lt;/span&gt; content, &lt;span style="color: #2b91af;"&gt;SpriteBatch&lt;/span&gt; spriteBatch, &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; seed)
        {
            beeMap = content.Load&amp;lt;&lt;span style="color: #2b91af;"&gt;Texture2D&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515;"&gt;"beemap"&lt;/span&gt;);
            &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.spriteBatch = spriteBatch;
            bees = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Bee&lt;/span&gt;&amp;gt;();
            r = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Random&lt;/span&gt;(seed);

            &lt;span style="color: #0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 5; i++)
            {
                AddRandomBee();
            }

        }

        &lt;span style="color: #0000ff;"&gt;private void&lt;/span&gt; AddRandomBee()
        {
            bees.Add(&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Bee&lt;/span&gt;(r.Next(numberOfBeeColors + 1)));
        }

        &lt;span style="color: #0000ff;"&gt;public void&lt;/span&gt; Draw()
        {
            &lt;span style="color: #0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 5; i++)
            {
                spriteBatch.Draw(beeMap, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Vector2&lt;/span&gt;(beeStartX + i * beeDeltaX, beeStartY), &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Rectangle&lt;/span&gt;(bees[i].Color * 91, 0, 91, 91), &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White);
            }
        }
    }&lt;/pre&gt;
&lt;p&gt;Most of this should look very familiar from the colum class except much simpler since the bees don&amp;rsquo;t move&lt;/p&gt;
&lt;p&gt;The Bee class itself is for now just holding the color of the bee&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;    class&lt;span style="color: #2b91af;"&gt; Bee&lt;/span&gt;&lt;span style="color: #000000;"&gt; { &lt;/span&gt;public int&lt;span style="color: #000000;"&gt; Color; &lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;public&lt;span style="color: #000000;"&gt; Bee(&lt;/span&gt;int&lt;span style="color: #000000;"&gt; color) { &lt;/span&gt;this&lt;span style="color: #000000;"&gt;.Color = color; } }&lt;/span&gt;&lt;/pre&gt;
&lt;h2&gt;Generating and drawing bees&lt;/h2&gt;
&lt;p&gt;In order to generate the bees and get them on the screen we add a BeePicker to the Game1 class&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #2b91af;"&gt; BeePicker&lt;/span&gt; beePicker = &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;&lt;/pre&gt;
&lt;p&gt;initialize the bee picker in the LoadContent class&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;            beePicker = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; BeePicker&lt;/span&gt;(Content, spriteBatch, System.&lt;span style="color: #2b91af;"&gt;DateTime&lt;/span&gt;.Now.Millisecond);&lt;/pre&gt;
&lt;p&gt;and then to draw it by calling beePicker.Draw in the Game1.Draw method&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (!gameOver)
            {
                &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                    c.Draw();
&lt;strong&gt; beePicker.Draw(); &lt;/strong&gt;            }&lt;/pre&gt;
&lt;p&gt;And voila, we have all of the UI in place.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3583.beePicker_5F00_089BBCF4.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="beePicker" border="0" alt="beePicker" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4336.beePicker_5F00_thumb_5F00_1782EC0E.png" width="292" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next time we will add the user interaction and put some finishing touches on this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276522" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>Bizzy Bees Step 6: User interaction (XNA Walkthrough)</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx</link><pubDate>Fri, 02 Mar 2012 15:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276523</guid><dc:creator>Tess1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276523</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx#comments</comments><description>&lt;p&gt;This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx"&gt;Overview&lt;/a&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1: Setting the stage (projects and assets) &lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The last step in the series is to add som user interaction so we can actually play the game.&lt;/p&gt;
&lt;h2&gt;Catching the users input in the Update method&lt;/h2&gt;
&lt;p&gt;The user interaction consists of taps and you can basically tap two areas of the screen, either the beepicker to select a bee, or the columns to match a bee with the bottommost flower.&lt;/p&gt;
&lt;p&gt;In Silverlight if you want to check when the user has clicked or tapped something, the most common way to do this is to add a tap or click eventhandler on a button or any other object, but in XNA there is no such thing as a control or a click event.&amp;nbsp; &lt;br /&gt;To handle user interaction in XNA you have to do two things.&lt;/p&gt;
&lt;p&gt;1. In the Initialize function you enable any gestures that you want to enable, for example Tap&lt;/p&gt;
&lt;pre style="color: #2b91af;"&gt;            TouchPanel&lt;span style="color: #000000;"&gt;.EnabledGestures = &lt;/span&gt;GestureType&lt;span style="color: #000000;"&gt;.Tap;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;This is a bitmap so you can add as many different gesture types as you want, for example if you wanted Tap and FreeDrag you would do GestureType.Tap | GestureType.FreeDrag.&lt;/p&gt;
&lt;p&gt;2. In the Update function, you check what gestures the user has done since the last update and act on them&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (!gameOver)
            {
                &lt;span style="color: #008000;"&gt;//Handle user interaction&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; &lt;strong&gt; while&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt; (&lt;span style="color: #2b91af;"&gt;TouchPanel&lt;/span&gt;.IsGestureAvailable) { &lt;span style="color: #2b91af;"&gt;GestureSample&lt;/span&gt; gesture = &lt;span style="color: #2b91af;"&gt;TouchPanel&lt;/span&gt;.ReadGesture(); &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (gesture.GestureType == &lt;span style="color: #2b91af;"&gt;GestureType&lt;/span&gt;.Tap) { HandleInput(gesture.Position); } } &lt;/strong&gt;
                &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                {
                    c.Update();
                    &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (c.ReachedBottom)
                    {
                        gameOver = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;
                        &lt;span style="color: #0000ff;"&gt;break&lt;/span&gt;;
                    }
                }
            }&lt;/pre&gt;
&lt;p&gt;NOTE! By reading the gesture with TouchPanel.ReadGesture() you remove it from the TouchPanels gesture, if you fail to do this, this will be an endless loop&lt;/p&gt;
&lt;h2&gt;Acting on the input&lt;/h2&gt;
&lt;p&gt;Ok, so now we are handling the input, it&amp;rsquo;s time to act on it, and rather than making this extremely complex and check for every single flower touch area or bee touch area we just say&lt;/p&gt;
&lt;p&gt;a) did they touch the bee picker area?&amp;nbsp; if so, handle bee selection&lt;/p&gt;
&lt;p&gt;b) do we already have a selected bee? if so, check if they touched a matching flower&lt;/p&gt;
&lt;p&gt;c) if neither of the above is true, then we just don&amp;rsquo;t give a hoot meaning all other taps will be ignored&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; private void&lt;/span&gt; HandleInput(&lt;span style="color: #2b91af;"&gt;Vector2&lt;/span&gt; position)
        {
            &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (position.X &amp;gt; 0 &amp;amp;&amp;amp; position.X &amp;lt; 480 &amp;amp;&amp;amp; position.Y &amp;gt; 700 &amp;amp;&amp;amp; position.Y &amp;lt; 800)
                HandleBeeSelection(position.X);
            &lt;span style="color: #0000ff;"&gt;else if&lt;/span&gt; (selectedBee != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)
                HandleFlowerSelection(position.X, position.Y);
        }&lt;/pre&gt;
&lt;p&gt;Even in the BeePicker we wont do any fancy schmanzy collision detection since there is a very easy way to know which bee you picked.&amp;nbsp; We know we have 5 bees so the index of the bee can be infered from the x position by simply dividing it by 5. &lt;br /&gt;but we&amp;rsquo;ll get to that in a little bit.&lt;/p&gt;
&lt;p&gt;Our HandleBeeSelection method will look like this&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; private void&lt;/span&gt; HandleBeeSelection(&lt;span style="color: #0000ff;"&gt;float&lt;/span&gt; x)
        {
            &lt;span style="color: #008000;"&gt;//first de-select any previously selected bee&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (selectedBee != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)
            {
                selectedBee.IsSelected = &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;;
                selectedBee = &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;
            }
            &lt;span style="color: #008000;"&gt;//Mark and select the new bee&lt;/span&gt;
            beePicker.MarkSelectedBee(x);
            selectedBee = beePicker.GetSelectedBee(x);
        }&lt;/pre&gt;
&lt;p&gt;The selection and deselection here will be used to give a visual cue to the user that a bee is selected&lt;/p&gt;
&lt;p&gt;So a couple of housekeeping things to make the above work.&lt;/p&gt;
&lt;p&gt;1. Add a &amp;ldquo;property&amp;rdquo; to the Bee class called IsSelected that will logically keep track of if the bee is selected or not (used only for drawing)&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;        public bool&lt;span style="color: #000000;"&gt; IsSelected = &lt;/span&gt;false&lt;span style="color: #000000;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;2. Implement the methods MarkSelectedBee and GetSelectedBee in the BeePicker&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;        public void&lt;span style="color: #000000;"&gt; MarkSelectedBee(&lt;/span&gt;float&lt;span style="color: #000000;"&gt; x) { GetSelectedBee(x).IsSelected = &lt;/span&gt;true&lt;span style="color: #000000;"&gt;; } &lt;/span&gt;public&lt;span style="color: #2b91af;"&gt; Bee&lt;/span&gt;&lt;span style="color: #000000;"&gt; GetSelectedBee(&lt;/span&gt;float&lt;span style="color: #000000;"&gt; x) { &lt;/span&gt;int&lt;span style="color: #000000;"&gt; index = (&lt;/span&gt;int&lt;span style="color: #000000;"&gt;)(x / beeDeltaX); &lt;/span&gt;return&lt;span style="color: #000000;"&gt; bees[index]; }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;3. Modify the BeePicker Draw method so that it draws the bee with a slight tint of DimGray if it is selected&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; public void&lt;/span&gt; Draw()
        {
            &lt;span style="color: #0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 5; i++)
            {
                &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;(bees[i].IsSelected)                    
                    spriteBatch.Draw(beeMap, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Vector2&lt;/span&gt;(beeStartX + i * beeDeltaX, beeStartY), &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Rectangle&lt;/span&gt;(bees[i].Color * 91, 0, 91, 91), &lt;strong&gt;&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.DimGray&lt;/strong&gt;);
                &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;
                    spriteBatch.Draw(beeMap, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Vector2&lt;/span&gt;(beeStartX + i * beeDeltaX, beeStartY), &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Rectangle&lt;/span&gt;(bees[i].Color * 91, 0, 91, 91), &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White);
            }
        }&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2262.selectedbee_5F00_7602FAD7.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="selectedbee" border="0" alt="selectedbee" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/6557.selectedbee_5F00_thumb_5F00_12503CF8.png" width="292" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you followed along so far you should now have something that looks like the above, where if you tap a bee it will turn slightly gray.&amp;nbsp; Notice that it is only the bee that turns Grey and not the background around it, this is because the area outside of the bee is transparent in the bee png and the color isn&amp;rsquo;t superimposed on the transparent areas which really works to our favor here.&lt;/p&gt;
&lt;h2&gt;Matching flowers and bees&lt;/h2&gt;
&lt;p&gt;The flower selection is a little bit trickier since we have to remove and replace bees and flowers but let&amp;rsquo;s look at the structure first&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; private void&lt;/span&gt; HandleFlowerSelection(&lt;span style="color: #0000ff;"&gt;float&lt;/span&gt; x, &lt;span style="color: #0000ff;"&gt;float&lt;/span&gt; y)
        {
            &lt;span style="color: #008000;"&gt;//verify that we are tapping inside a column&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (x &amp;gt; 10 &amp;amp;&amp;amp; x &amp;lt; 470 &amp;amp;&amp;amp; y &amp;gt; 100 &amp;amp;&amp;amp; y &amp;lt; 700)
            {
                &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; rainbowColor = 6;
                &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; selectedColumnIndex = (&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;)((x - 10) / 92);
                &lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; selectedColumn = columns[selectedColumnIndex];
                &lt;span style="color: #2b91af;"&gt;Flower&lt;/span&gt; selectedFlower = selectedColumn.GetBottomFlower();

                &lt;span style="color: #008000;"&gt;//check if we have a match or if it was a rainbow flower&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt;(selectedFlower != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; (selectedFlower.Color == selectedBee.Color || selectedFlower.Color == rainbowColor))
                {
                    &lt;span style="color: #008000;"&gt;//remove the bottom flower&lt;/span&gt;
                    selectedColumn.RemoveBottomFlower();
                    
                    &lt;span style="color: #008000;"&gt;//replace the bee - making sure that there is always a match by passing in a list of all the bottom flower colors&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;&amp;gt; availableFlowers = GetAvailableFlowers();
                    beePicker.RemoveAndReplaceBee(selectedBee, availableFlowers);

                    &lt;span style="color: #008000;"&gt;//deselect the bee&lt;/span&gt;
                    beePicker.DeselectAll();
                    selectedBee = &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;

                    &lt;span style="color: #008000;"&gt;//if it was a rainbow flower - add points&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (selectedFlower.Color == rainbowColor)
                    {
                        score++;
                        &lt;span style="color: #008000;"&gt;//if we reached 10, 20, 30... points, increase the velocity to make the game harder as we go along&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; ((score % 10) == 0)
                        {
                            &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                                c.Velocity += 0.1f;
                        }
                    }
                }
            }
        }&lt;/pre&gt;
&lt;p&gt;We verify that we are in an actual column, and find the bottom flower of that column to see what color it is. &lt;br /&gt;If it matches the bee or if it is a rainbow flower (meaning it matches all bees) we remove the flower and we replace the bee.&lt;/p&gt;
&lt;p&gt;In order to not get locked up in a state where we have no matching bees and flowers we pass in a list of all the bottom flowers to ensure that we have at least one match, or else the replacing bee needs to match one of the flowers.&lt;/p&gt;
&lt;p&gt;At the end of the function we increase the score (number of rainbow flowers collected) if it was a rainbow flower, and to make the game progressively harder we increase the velocity of all the columns.&amp;nbsp; Remember? this is the variable that the Columns use in the update function to progress the position of the flowers.&lt;/p&gt;
&lt;p&gt;Now we have a few methods that we need to implement to get this working.&lt;/p&gt;
&lt;p&gt;In the Column class we implement the methods GetBottomFlower and RemoveBottomFlower, this is a pretty easy task since we use Lists and the bottom flower is always at index 0&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;        public&lt;span style="color: #2b91af;"&gt; Flower&lt;/span&gt;&lt;span style="color: #000000;"&gt; GetBottomFlower() { &lt;/span&gt;if&lt;span style="color: #000000;"&gt; (flowers.Count &amp;gt; 0) &lt;/span&gt;return&lt;span style="color: #000000;"&gt; flowers[0]; &lt;/span&gt;else
                return null&lt;span style="color: #000000;"&gt;; } &lt;/span&gt;internal void&lt;span style="color: #000000;"&gt; RemoveBottomFlower() { &lt;/span&gt;if&lt;span style="color: #000000;"&gt; (flowers.Count &amp;gt; 0) flowers.RemoveAt(0); }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;The GetAvailableFlowers method in the Game1 class uses the GetBottomFlower function to generate a list of all the bottom flowers in the columns&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;&amp;gt; GetAvailableFlowers()
        {
            &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;&amp;gt; flowerColors = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;&amp;gt;();
            &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
            {
                &lt;span style="color: #2b91af;"&gt;Flower&lt;/span&gt; f = c.GetBottomFlower();
                &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (f != &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;)
                    flowerColors.Add(f.Color);
            }
            &lt;span style="color: #0000ff;"&gt;return&lt;/span&gt; flowerColors;
        }&lt;/pre&gt;
&lt;p&gt;In the BeePicker class we need to implement the DeselectAll and RemoveAndReplaceBee methods&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; public void&lt;/span&gt; RemoveAndReplaceBee(&lt;span style="color: #2b91af;"&gt;Bee&lt;/span&gt; selectedBee, &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;&amp;gt; availableFlowers)
        {
            &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; beeIndex = bees.IndexOf(selectedBee);

            &lt;span style="color: #008000;"&gt;//check if we already have a bee that matches the available flowers //remember to skip over the selectedBee since it will be removed in a moment&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; bool&lt;/span&gt; match = &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;;
            &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; rainbowColor = 6;

            &lt;span style="color: #008000;"&gt;//if there is a rainbow flower it will always match&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (availableFlowers.Contains(rainbowColor))
                match = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;
            &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;
            {
                &lt;span style="color: #0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; bees.Count; i++)
                {
                    &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;(i != beeIndex &amp;amp;&amp;amp; availableFlowers.Contains(bees[i].Color)){
                        match = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;
                        &lt;span style="color: #0000ff;"&gt;break&lt;/span&gt;;
                    }
                }
            }

            &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; color;
            &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt;(match){
                &lt;span style="color: #008000;"&gt;//we already have a match, just add a random colored bee&lt;/span&gt;
                color = r.Next(numberOfBeeColors + 1 );
            }
            &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;{
                &lt;span style="color: #008000;"&gt;//we have no match so we must pick a color from the available colors&lt;/span&gt;
                color = availableFlowers[r.Next(availableFlowers.Count)];
            }

            &lt;span style="color: #008000;"&gt;//set the selected bee to the new color to "create" a new bee&lt;/span&gt;
            bees[beeIndex].Color = color;
        }

        &lt;span style="color: #0000ff;"&gt;internal void&lt;/span&gt; DeselectAll()
        {
            &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Bee&lt;/span&gt; bee &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; bees)
                bee.IsSelected = &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;;
        }&lt;/pre&gt;
&lt;p&gt;The RemoveAndReplaceBee method seems a bit more complex&amp;hellip; but what we do here is really to check if the bees we have left match any of the available flowers (to make sure we always have a match) &lt;br /&gt;If we already have a match, we can just add a new random bee to replace the old one, but if we don&amp;rsquo;t we need to make the new bee match one of the existing flowers.&lt;/p&gt;
&lt;p&gt;And finally, yay! we are done, and have a playable game&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/3718.done_5F00_5D6337BA.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="done" border="0" alt="done" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/0741.done_5F00_thumb_5F00_52E2639A.png" width="292" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the last article in the series I will discuss a few problems with the game that I will leave up to the reader to fix, and discuss a few things I have done in the &amp;ldquo;real&amp;rdquo; game to make the game, at least in my opinion, a bit more interesting&lt;img class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1234.wlEmoticon_2D00_smile_5F00_17AE87CF.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276523" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>Bizzy Bees Step 7: Rounding it up (XNA Walkthrough)</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx</link><pubDate>Fri, 02 Mar 2012 15:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276525</guid><dc:creator>Tess1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276525</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx#comments</comments><description>&lt;p&gt;This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx"&gt;Overview&lt;/a&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1: Setting the stage (projects and assets) &lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;A few issues in the game &amp;ndash; left for you to fix&lt;/h2&gt;
&lt;p&gt;If you try to play the game a few times you may notice a couple of things&lt;/p&gt;
&lt;p&gt;1. When the game starts, there may not always be a matching flower and bee&lt;/p&gt;
&lt;p&gt;2. If you manage to empty a column, you may run into an issue where you are either blocked because there are no matching flowers and bees or it may crash&lt;/p&gt;
&lt;p&gt;In the real game I have added a lot of logic around adding matching flowers when we start and when columns are empty but the logic for this was a bit too cumbersome to add to the walkthrough without making it completely incomprehensible in short articles.&lt;/p&gt;
&lt;h2&gt;How about a menu system?&lt;/h2&gt;
&lt;p&gt;Very few games start you off already in the game, but it makes it a bit easier to demo&lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5460.wlEmoticon_2D00_smile_5F00_5810FEB1.png" /&gt; As of mango you can mix XNA and Silverlight to do menus for example but for Bizzy Bees I started off with a code sample from the App Hub called Game State Management &lt;a title="http://create.msdn.com/en-US/education/catalog/sample/game_state_management" href="http://create.msdn.com/en-US/education/catalog/sample/game_state_management"&gt;http://create.msdn.com/en-US/education/catalog/sample/game_state_management&lt;/a&gt; which let&amp;rsquo;s you create different types of screens for menus, gameplay, highscores and pausing.&amp;nbsp; It also includes functionality for handling tombstoning which is pretty nice.&lt;/p&gt;
&lt;p&gt;One thing worth mentioning here is that when you use the back button in a game it is ok to bring up a pause screen and typically when you come back to a game you would also bring up a pause screen before you continue, so it&amp;rsquo;s a little bit different than Silverlight apps in that regard.&lt;/p&gt;
&lt;h2&gt;&lt;/h2&gt;
&lt;h2&gt;Sound and SoundEffects&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m one of those people who turn off the sound in all games immediately as I start the game, but I realize that a game feels pretty flat and incomplete if there isn&amp;rsquo;t at least an option to have game sound.&amp;nbsp; I find &lt;a title="http://www.soundjay.com/" href="http://www.soundjay.com/"&gt;http://www.soundjay.com/&lt;/a&gt; to be a pretty good source for random sounds, and a lot of the gametype sounds are extremely easy to create with a tool like Audacity and common household objects&lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5460.wlEmoticon_2D00_smile_5F00_5810FEB1.png" /&gt;&lt;/p&gt;
&lt;p&gt;If you want to use Sound in a game you create either a SoundEffect object or a SoundEffectInstance object, drop your audio file in then content project, load it with the content pipeline Content.Load&amp;lt;SoundEffect&amp;gt;(&amp;ldquo;TheNameOfTheSoundEffect&amp;rdquo;)() just like with textures.&lt;/p&gt;
&lt;p&gt;The difference between a SoundEffect and a SoundEffectInstance is that a SoundEffect is fire and forget, i.e. you call Play on it, and then when it is done playing it stops.&amp;nbsp; With a SoundEffectInstance you can loop, move back and forward, pause etc. so it depends a little what you need it for, i.e. just for a sound effect or for background noise.&amp;nbsp;&amp;nbsp; You can have 16 sounds playing simultaneously, but I really wouldnt recommend it unless you want to drive the player crazy&lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5460.wlEmoticon_2D00_smile_5F00_5810FEB1.png" /&gt;&lt;/p&gt;
&lt;h2&gt;Levels, achievements, instructions and PowerUps&lt;/h2&gt;
&lt;p&gt;In Bizzy&amp;nbsp; Bees there is a marathon mode which is basically what we have been coding up here, and then there is a story mode where you follow a path through the seasons.&amp;nbsp; The story gets progressively harder, as more and more flowers and different powerups are introduced and the speed and the goal increases.&lt;/p&gt;
&lt;p&gt;In order to make this easy to configure as I was testing out the levels, and also to be able to add new levels I created a level system using XML.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&amp;lt;LevelInfo xmlns:xsd="&lt;a href="http://www.w3.org/2001/XMLSchema&amp;quot;"&gt;http://www.w3.org/2001/XMLSchema"&lt;/a&gt; xmlns:xsi="&lt;a href="http://www.w3.org/2001/XMLSchema-instance&amp;quot;"&gt;http://www.w3.org/2001/XMLSchema-instance"&lt;/a&gt;&amp;gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;LevelGroups&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LevelGroup ColorB="245" ColorG="245" ColorR="245" PosY="93" PosX="36" GroupName="Winter" Major="1"&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Levels&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Level HasQueen="false" InitialVelocity="0.5" NumColumns="3" Minor="1"&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Flowers&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LevelFlower Color="Red" IsNew="true"/&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LevelFlower Color="Blue" IsNew="true"/&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LevelFlower Color="Pink" IsNew="true"/&amp;gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Flowers&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Powerups/&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Goal NumFlowers="10" IsTimed="false"/&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Level&amp;gt; &lt;br /&gt;&amp;hellip;&lt;/p&gt;
&lt;p&gt;Using this I can automatically generate the levels and also automatically generate the instruction screens that appear before each level with the goal, new powerups and new flowers.&amp;nbsp; I liked this way of generating levels because it let me quickly test out new powerups etc. without having to play the game from start to finish each time.&lt;/p&gt;
&lt;p&gt;I spent a long time testing out levels and different powerups on various people in my vecinity, mostly because as I was developing the game I was testing it so much and got so &amp;ldquo;good&amp;rdquo; at it that I had a hard time looking at it with a beginners eyes.&amp;nbsp; Still I think that the levels aren&amp;rsquo;t perfect but at least they are better than they would have been without the user testing&lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5460.wlEmoticon_2D00_smile_5F00_5810FEB1.png" /&gt;&lt;/p&gt;
&lt;p&gt;For achievements, since I am not connected to XBOX live I decided to take the Star/Medal approach and let the user get a silver or a gold medal depending on how many lives they have left when they reach the goal.&amp;nbsp; I like the achievements even if they are this simple because at least for me, it makes me play the game more times just to get that gold medal or extra star.&lt;/p&gt;
&lt;p&gt;I also spent a bit of time calibrating it so that each round or attempt at marathon mode would be long enough to be interesting but short enough to be one of those games that kids can sit in the back of the car and take turns with.&lt;/p&gt;
&lt;p&gt;Anyhow, I am far from a pro game developer but thought I&amp;rsquo;d share some of my thoughts and ideas on the subject&amp;hellip; I would love to hear yours.&lt;/p&gt;
&lt;h2&gt;HTML5 and Javascript &amp;ndash; taking it to the big screen&lt;/h2&gt;
&lt;p&gt;Just for kicks I have also ported the demo that I have been writing about here to HTML5 and Javascript if you want to try it out &lt;a title="http://merkurit.se/bizzybeez/bizzybeez.htm" href="http://merkurit.se/bizzybeez/bizzybeez.htm"&gt;here&lt;/a&gt; from a browser&amp;hellip; and yes, I misspelled my own game it&amp;rsquo;s supposed to be Bizzy Bees&lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5460.wlEmoticon_2D00_smile_5F00_5810FEB1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Hope you&amp;rsquo;ve had fun making the game&amp;hellip; If you have written some of your own games, feel free to add them in the comments. Would be fun to try them out.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have a good one&lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276525" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>Bizzy Bees Step 3: Adding flowers (XNA Walkthrough)</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx</link><pubDate>Fri, 02 Mar 2012 15:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276518</guid><dc:creator>Tess1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276518</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx#comments</comments><description>&lt;p&gt;This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx"&gt;Overview&lt;/a&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1: Setting the stage (projects and assets) &lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now we have set the scener for our game, it&amp;rsquo;s time to add the &amp;ldquo;players&amp;rdquo; or rather the flowers to the scene.&lt;/p&gt;
&lt;p&gt;The first thing we need to do is to add two classes, Colum and Flower (you can right click the project and choose add new/class from the code section)&lt;/p&gt;
&lt;h2&gt;The Column class&lt;/h2&gt;
&lt;p&gt;The Column class will look like this:&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; class&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Column&lt;/span&gt;
    {
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; columnTop = 150;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; numberOfFlowerColors = 6;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; rainbowFlowerColor = 6;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; flowerDeltaY = 80;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; flowerWidth = 72;
        &lt;span style="color: #0000ff;"&gt;const int&lt;/span&gt; flowerHeight = 72;
        
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Flower&lt;/span&gt;&amp;gt; flowers = &lt;span style="color: #0000ff;"&gt;null&lt;/span&gt;;
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; SpriteBatch&lt;/span&gt; spriteBatch;
        &lt;span style="color: #0000ff;"&gt;private float&lt;/span&gt; x;
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Random&lt;/span&gt; r;
        &lt;span style="color: #0000ff;"&gt;private&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Texture2D&lt;/span&gt; flowerMap;


        &lt;span style="color: #0000ff;"&gt;public&lt;/span&gt; Column(&lt;span style="color: #2b91af;"&gt;ContentManager&lt;/span&gt; content, &lt;span style="color: #2b91af;"&gt;SpriteBatch&lt;/span&gt; spriteBatch, &lt;span style="color: #0000ff;"&gt;float&lt;/span&gt; x, &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; seed)
        {
            &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.spriteBatch = spriteBatch;
            &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.x = x;
            &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.flowers = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Flower&lt;/span&gt;&amp;gt;();
            &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.r = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Random&lt;/span&gt;(seed);
            &lt;span style="color: #0000ff;"&gt;this&lt;/span&gt;.flowerMap = content.Load&amp;lt;&lt;span style="color: #2b91af;"&gt;Texture2D&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515;"&gt;"flowermap"&lt;/span&gt;);

            &lt;span style="color: #008000;"&gt;//add 3 flowers&lt;/span&gt;
            AddRandomFlower(x, columnTop + 2 * flowerDeltaY);
            AddRandomFlower(x, columnTop + flowerDeltaY);
            AddRandomFlower(x, columnTop);
        }

        &lt;span style="color: #0000ff;"&gt;private void&lt;/span&gt; AddRandomFlower(&lt;span style="color: #0000ff;"&gt;float&lt;/span&gt; x, &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; y)
        {
            &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; color = r.Next(numberOfFlowerColors+1);
            flowers.Add(&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Flower&lt;/span&gt;(color, x, y));
        }

        &lt;span style="color: #0000ff;"&gt;public void&lt;/span&gt; Draw()
        {
            &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Flower&lt;/span&gt; flower &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; flowers)
            {
                spriteBatch.Draw(flowerMap, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Vector2&lt;/span&gt;(flower.X, flower.Y), &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Rectangle&lt;/span&gt;(flower.Color * flowerWidth, 0, flowerWidth, flowerHeight), &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White);
            }
        }
    }&lt;/pre&gt;
&lt;p&gt;First we have a few constants just to keep track of where to position the columns and the flowers.&lt;/p&gt;
&lt;p&gt;After this we have the list of flowers contained in the column, the position of the column x wise, a randomizer that will allow us to create random flowers, a reference to the global spriteBatch as well as a Texture2D to hold our flower spritemap.&lt;/p&gt;
&lt;p&gt;In the constructor we add 3 random flowers spaced 80 px apart.&lt;/p&gt;
&lt;p&gt;Finally we have the draw method where we will draw all the flowers that belong to this column.&amp;nbsp; Since we are using a spritemap we can&amp;rsquo;t just draw the whole image. If we did we would draw all 6 flower types. So we use an override for the Draw method that takes a Rectangle parameter.&amp;nbsp; This rectangle specifies which part of the spritemap it should draw, and since our color is also the position in the spritemap we can very easily use this to calculate the x position the rectangle should start at.&lt;/p&gt;
&lt;h2&gt;The Flower class&lt;/h2&gt;
&lt;p&gt;The Flower class is extremely simple. It just contains the position we should paint at, and the color of the flower&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;    class&lt;span style="color: #2b91af;"&gt; Flower&lt;/span&gt;&lt;span style="color: #000000;"&gt; { &lt;/span&gt;public int&lt;span style="color: #000000;"&gt; Color; &lt;/span&gt;public float&lt;span style="color: #000000;"&gt; X; &lt;/span&gt;public float&lt;span style="color: #000000;"&gt; Y; &lt;/span&gt;public&lt;span style="color: #000000;"&gt; Flower(&lt;/span&gt;int&lt;span style="color: #000000;"&gt; color, &lt;/span&gt;float&lt;span style="color: #000000;"&gt; x, &lt;/span&gt;float&lt;span style="color: #000000;"&gt; y) { &lt;/span&gt;this&lt;span style="color: #000000;"&gt;.Color = color; &lt;/span&gt;this&lt;span style="color: #000000;"&gt;.X = x; &lt;/span&gt;this&lt;span style="color: #000000;"&gt;.Y = y; } }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Now, all that is left to do is to generate the columns and draw them in the Game1 class&lt;/p&gt;
&lt;h2&gt;Generating and drawing the columns&lt;/h2&gt;
&lt;p&gt;1. Create a new function called InitializeColumns that looks like this, where we generate 5 columns, spaced 92 px apart, and send in the randomizer seed.&amp;nbsp; We need to send in references to the spriteBatch and Content pipeline here so that it can be used in the Column class to load and draw the flowers&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; private void&lt;/span&gt; InitializeColumns()
        {
            columns = &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt;&amp;gt;();

            &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; seed = System.&lt;span style="color: #2b91af;"&gt;DateTime&lt;/span&gt;.Now.Millisecond;
            &lt;span style="color: #0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 5; i++)
            {
                columns.Add(&lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Column&lt;/span&gt;(Content, spriteBatch, i * 92 + 22, seed + i));
            }
        }&lt;/pre&gt;
&lt;p&gt;2. Call this method at the end of the LoadContent() method&lt;/p&gt;
&lt;p&gt;3. In the draw method, right under the //TODO: Draw flowers and bees here comment paste the following code that will draw all the columns&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #008000;"&gt; //TODO: Draw flowers and bees here&lt;/span&gt;&lt;span style="color: #0000ff;"&gt; foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                c.Draw();&lt;/pre&gt;
&lt;p&gt;While we are at it, we can also take the opportunity to draw a small rainbow flower in the HUD.&lt;/p&gt;
&lt;p&gt;1. Create a new member variable in the Game1 class to hold the flowermap texture we will use to display the flower&lt;/p&gt;
&lt;pre style="color: #2b91af;"&gt;        Texture2D&lt;span style="color: #000000;"&gt; flowerMapTexture;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;2. Load up the flower map in LoadContent&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;            flowerMapTexture = Content.Load&amp;lt;&lt;span style="color: #2b91af;"&gt;Texture2D&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515;"&gt;"flowermap"&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt;3. Draw it in the DrawHUD method&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;            spriteBatch.Draw(flowerMapTexture, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Vector2&lt;/span&gt;(40, 45), &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Rectangle&lt;/span&gt;(6*72, 0, 72, 72), &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White, 0, &lt;span style="color: #2b91af;"&gt;Vector2&lt;/span&gt;.Zero, 0.5f, &lt;span style="color: #2b91af;"&gt;SpriteEffects&lt;/span&gt;.None, 0f);&lt;/pre&gt;
&lt;p&gt;Here we are drawing it pretty much the same way we did in the Column class, specifying a rectangle to start with.&amp;nbsp; But this call has a lot more parameters, why?&amp;nbsp; &lt;br /&gt;The reason is because I wanted to scale the flower to half its height and width by setting the scale to 0.5f, the other parameters have to do with SpriteEffects, rotation and layerdepth but all those are set to their defaults so all we are doing here is scaling.&lt;/p&gt;
&lt;p&gt;If you run the app now, your screen should look something like this which I think is pretty nice looking&lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1460.wlEmoticon_2D00_smile_5F00_23ED2567.png" /&gt; but in truth it gets pretty boring after a while&amp;hellip;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1447.addingColumns_5F00_387274E5.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="addingColumns" border="0" alt="addingColumns" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2818.addingColumns_5F00_thumb_5F00_4EE5136C.png" width="292" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next time we&amp;rsquo;ll add some moving parts to get the party started.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276518" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>Bizzy Bees Step 4: Making things move (XNA Walkthrough)</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx</link><pubDate>Fri, 02 Mar 2012 15:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276519</guid><dc:creator>Tess1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276519</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx#comments</comments><description>&lt;p&gt;This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx"&gt;Overview&lt;/a&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1: Setting the stage (projects and assets) &lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Animating objects in XNA is extremely simple.&amp;nbsp; To move something we just change the position of the objects in the update method. To resize an object we can add a variable for scale that we can update in the update method and then we use that variable in the draw method etc.&lt;/p&gt;
&lt;p&gt;If you want to do more complex animation like a bee flapping it&amp;rsquo;s wings or an object exploding you would use a spritemap with different images depicting different stages of the animation and advance the frame each time.&amp;nbsp; If you want to animate a bee flipping it&amp;rsquo;s wings you can make this look pretty convincingly by using two images (one with wings up and one with wings down and then toggle between them every 4 frames or so)&lt;/p&gt;
&lt;h2&gt;Animating the flowers&lt;/h2&gt;
&lt;p&gt;In our case, we want the flowers to move downwards at a steady pace.&lt;/p&gt;
&lt;p&gt;1. Add a new membervariable to the Column class called Velocity (we&amp;rsquo;ll make this public so we can modify it easily later, you&amp;rsquo;ll see why).&amp;nbsp; &lt;br /&gt;The 0.4 here is how many pixels the flowers will move downwards per frame.&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;        public float&lt;span style="color: #000000;"&gt; Velocity = 0.4f;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;2. Add a new method to the Column class called Update where we move all the flowers downwards by changing the Y position&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; public void&lt;/span&gt; Update()
        {
            &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Flower&lt;/span&gt; f &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; flowers)
            {
                f.Y += Velocity;
            }
        }&lt;/pre&gt;
&lt;p&gt;3. Finally, call the columns Update method from the Update method in the Game1 class so that it gets called for each frame&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                {
                    c.Update();
                }&lt;/pre&gt;
&lt;h2&gt;What happens if you take too long to draw?&lt;/h2&gt;
&lt;p&gt;If you have payed attention you now know that we call Draw and Update 30 times a second, so what would happen if we suddenly take more than our allotted time when we draw or something?&lt;/p&gt;
&lt;p&gt;Well, what will happen is that by default XNA will drop draws if it can&amp;rsquo;t complete the whole Update/Draw cycle in time, so that it can still keep a steady pace.&amp;nbsp; In this case that would mean that sometimes the flowers would move 0.8px in one go. &lt;br /&gt;In the Game1 Update and Draw functions though you get a parameter GameTime that you can use if you need to do timebased stuff like updating a clock or something.&amp;nbsp; However, usually for simple games like this one, unless you have a really complex 3D world that you are dealing with, you can get away with a lot of things and still keep the Update/Draw cycle.&lt;/p&gt;
&lt;p&gt;Back to our game. If you have followed along your flowers should be moving now, but there are two big problems&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8156.badmove_5F00_1F126F7A.png"&gt;&lt;img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="badmove" border="0" alt="badmove" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4846.badmove_5F00_thumb_5F00_754EF486.png" width="148" height="244" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7651.badmove2_5F00_53EF4EEA.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="badmove2" border="0" alt="badmove2" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5008.badmove2_5F00_thumb_5F00_3F1D566A.png" width="148" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First off, we don&amp;rsquo;t do anything to add new flowers when the flowers are dropping down, and secondly the flowers will just keep moving forever, even off the screen.&amp;nbsp; What really should happen is that the game should be finito when the flowers reach the bottom.&lt;/p&gt;
&lt;h2&gt;Game Over&lt;/h2&gt;
&lt;p&gt;Ok, let&amp;rsquo;s fix the 2nd problem first.&lt;/p&gt;
&lt;p&gt;1. Add a new member variable to the Game1 class&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;        bool&lt;span style="color: #000000;"&gt; gameOver = &lt;/span&gt;false&lt;span style="color: #000000;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;2. In the Update method in the Game1 class change the column update loop to check if the flowers reached the bottom and set the gameOver flag if they have&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; if&lt;/span&gt; (!gameOver)
            {
                &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                {
                    c.Update();
                    &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (c.ReachedBottom)
                    {
                        gameOver = &lt;span style="color: #0000ff;"&gt;true&lt;/span&gt;;
                        &lt;span style="color: #0000ff;"&gt;break&lt;/span&gt;;
                    }
                }
            }&lt;/pre&gt;
&lt;p&gt;3. In the column class add a constant for columnBottom and a property called ReachedBottom that checks if the first flower reached the bottom&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;        const int&lt;span style="color: #000000;"&gt; columnBottom = 620; &lt;/span&gt;public bool&lt;span style="color: #000000;"&gt; ReachedBottom { &lt;/span&gt;get&lt;span style="color: #000000;"&gt; { &lt;/span&gt;if&lt;span style="color: #000000;"&gt; (flowers.Count != 0 &amp;amp;&amp;amp; flowers[0].Y &amp;gt;= columnBottom) &lt;/span&gt;return true&lt;span style="color: #000000;"&gt;; &lt;/span&gt;else
                    return false&lt;span style="color: #000000;"&gt;; } }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Now the updates will stop, but nothing else will really happen so we need to print out an endgame message when the game is over&lt;/p&gt;
&lt;p&gt;Change the code for the Draw method in Game1 so that it looks like this&lt;/p&gt;
&lt;pre style="color: #000000;"&gt;&lt;span style="color: #0000ff;"&gt; protected override void&lt;/span&gt; Draw(&lt;span style="color: #2b91af;"&gt;GameTime&lt;/span&gt; gameTime)
        {
            GraphicsDevice.Clear(&lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.CornflowerBlue);


            spriteBatch.Begin();
            spriteBatch.Draw(backgroundTexture, &lt;span style="color: #2b91af;"&gt;Vector2&lt;/span&gt;.Zero, &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White);

            &lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (!gameOver)
            {
                &lt;span style="color: #0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Column&lt;/span&gt; c &lt;span style="color: #0000ff;"&gt;in&lt;/span&gt; columns)
                    c.Draw();
            }
            &lt;span style="color: #0000ff;"&gt;else&lt;/span&gt;
            {
                spriteBatch.DrawString(largeFont, &lt;span style="color: #a31515;"&gt;"GAME OVER"&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;new&lt;/span&gt;&lt;span style="color: #2b91af;"&gt; Vector2&lt;/span&gt;(150, 400), &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.Red);
            }
            
            spriteBatch.Draw(foregroundTexture, &lt;span style="color: #2b91af;"&gt;Vector2&lt;/span&gt;.Zero, &lt;span style="color: #2b91af;"&gt;Color&lt;/span&gt;.White);
            DrawHUD();
            spriteBatch.End();

            &lt;span style="color: #0000ff;"&gt;base&lt;/span&gt;.Draw(gameTime);
        }&lt;/pre&gt;
&lt;p&gt;When the game is over we now draw a Game Over message instead of drawing the columns, which is pretty neat.&lt;/p&gt;
&lt;h2&gt;Creating a flower factory&lt;/h2&gt;
&lt;p&gt;Ok, so we fixed that, now let&amp;rsquo;s fix the code so we keep filling up the columns with new flowers as we go along.&lt;/p&gt;
&lt;p&gt;In the Column.Update method add the following code to add new flowers when the topmost flower has passed the starting point&lt;/p&gt;
&lt;pre style="color: #0000ff;"&gt;            if&lt;span style="color: #000000;"&gt; (flowers.Count == 0 || flowers[flowers.Count - 1].Y &amp;gt; columnTop) AddRandomFlower(x, columnTop - flowerDeltaY);&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Now you should have a fully functioning flower factory and a way to end the game, but no way to win it.&amp;nbsp; don&amp;rsquo;t worry we&amp;rsquo;ll get there&amp;hellip;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7536.movingflowers_5F00_1DBDB0CE.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="movingflowers" border="0" alt="movingflowers" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8787.movingflowers_5F00_thumb_5F00_412A2F66.png" width="292" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;next time we&amp;rsquo;ll add in the bees to make the game a bit more complete&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276519" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>XNA for Windows Phone Walkthrough–Creating the Bizzy Bees game</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx</link><pubDate>Fri, 02 Mar 2012 15:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276515</guid><dc:creator>Tess1</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276515</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.windowsphone.com/en-us/apps/403e83f4-9371-e011-81d2-78e7d1fa76f8"&gt;&lt;img style="margin: 0px 10px 10px 0px; display: inline; float: left;" align="left" src="http://catalog.zune.net/v3.2/en-US/image/7cca5bf6-9e25-4599-815a-bf59a4c3c88f?width=150&amp;amp;height=150&amp;amp;resize=true" width="90" height="150" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;About a year back I wrote my first XNA game for Windows Phone.&amp;nbsp;&amp;nbsp; The game is called Bizzy Bees and you can download and play it for free from the &lt;a href="http://www.windowsphone.com/en-us/apps/403e83f4-9371-e011-81d2-78e7d1fa76f8"&gt;Marketplace&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The idea of the app is quite simple&amp;hellip; the goal is to collect as many rainbow flowers as you can before all the flowers hit the bottom.&amp;nbsp;&amp;nbsp; You collect flowers by matching flowers and bees, so a yellow flower matches with a yellow be, a pink flower with a pink bee etc. and all bees match up with rainbow flowers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this series we&amp;rsquo;ll walk through creating a subset of that game from start to finish.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1:&amp;nbsp;Setting the stage (projects and assets)&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The full project is attached to this post if you want to download and play with it.&lt;/p&gt;
&lt;p&gt;/Tess&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276515" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-27-65-15/DemoGame.zip" length="454337" type="application/zip" /><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>Bizzy Bees Step 1: Setting the stage (XNA walkthrough)</title><link>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx</link><pubDate>Fri, 02 Mar 2012 15:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10276516</guid><dc:creator>Tess1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/tess/rsscomments.aspx?WeblogPostID=10276516</wfw:commentRss><comments>http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx#comments</comments><description>&lt;p&gt;This is part of a walkthrough series on creating a game (Bizzy Bees) in XNA&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/xna-for-windows-phone-walkthrough-creating-the-bizzy-bees-game.aspx"&gt;Overview&lt;/a&gt;&lt;br /&gt; &lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-1-setting-the-stage-xna-walkthrough.aspx"&gt;Step 1: Setting the stage (projects and assets) &lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-2-drawing-the-scene-xna-walkthrough.aspx"&gt;Step 2: Drawing the scene&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-3-adding-flowers-xna-walkthrough.aspx"&gt;Step 3: Adding flowers&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-4-making-things-move-xna-walkthrough.aspx"&gt;Step 4: Making things move&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-5-adding-some-bees-to-the-mix-xna-walkthrough.aspx"&gt;Step 5: Adding some bees to the mix&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-6-user-interaction-xna-walkthrough.aspx"&gt;Step 6: User interaction&lt;/a&gt; &lt;br /&gt;&lt;a href="http://blogs.msdn.com/b/tess/archive/2012/03/02/bizzy-bees-step-7-rounding-it-up-xna-walkthrough.aspx"&gt;Step 7: Rounding it up&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;The architecture of a game with a gameloop&lt;/h2&gt;
&lt;p&gt;XNA is very different from winforms applications or Silverlight apps in that it is not eventdriven but rather uses the concept of a GameLoop where you update and redraw the whole surface for each frame. On Windows Phone by default you draw 30 frames per second, so 30 times per second you update the locations of the objects, check for user input and redraw the screen.&lt;/p&gt;
&lt;p&gt;The picture below shows the lifetime of any game written in XNA, whether it is on Windows Phone, XBox or Windows&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/8750.image_5F00_2037A895.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5187.image_5F00_thumb_5F00_37EEDFFB.png" width="644" height="194" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Initialize&lt;/strong&gt; &amp;ndash; This is where we set the stage, set up the levels etc.&amp;nbsp; this is essentially the constructor of the whole game&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;LoadContent&lt;/strong&gt; &amp;ndash; This is where we load all the graphical assets, sounds and fonts we will use later&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Update/Draw loop &lt;/strong&gt;&amp;ndash; This loops 30 times per second (if you use the defaults for WP7).&amp;nbsp; If, for example you have a car that will move from the left to the right on the screen you would update it&amp;rsquo;s x position a small fraction in every update, and then in draw you would draw the image of the car with the updated position.&amp;nbsp; If you think of it as a film reel, you draw one frame in the real everytime draw is called, and the update is there to be able to change the scene between draws.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UnloadContent&lt;/strong&gt; &amp;ndash; most XNA developers never have to care about this since content is unloaded automatically if you use the content pipeline provided with XNA, but this method is called at the end of the game and can be used to clean up complex structures.&lt;/p&gt;
&lt;p&gt;When you create an XNA project in Visual Studio this is all set up for you.&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;The architecture of the Bizzy Bees game&lt;/h2&gt;
&lt;p&gt;The assets we are going to use in our game consist of 5 png images.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First off we have the background layer that always sits statically in the background.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/4024.GameScreenBackground_5F00_447C8D17.png"&gt;&lt;img style="background-image: none; margin: 0px 12px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="GameScreenBackground" border="0" alt="GameScreenBackground" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1781.GameScreenBackground_5F00_thumb_5F00_22B0B486.png" width="144" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Same with the foreground layer and the HUD (score panel)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5483.GameScreenForeground_5F00_216C1BA7.png"&gt;&lt;img style="background-image: none; margin: 0px 12px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="GameScreenForeground" border="0" alt="GameScreenForeground" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/2437.GameScreenForeground_5F00_thumb_5F00_072BB283.png" width="144" height="240" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5657.HUDBackground_5F00_34ACD246.png"&gt;&lt;img style="background-image: none; margin: 0px 12px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="HUDBackground" border="0" alt="HUDBackground" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5483.HUDBackground_5F00_thumb_5F00_1F4F1CDE.png" width="180" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Think of it a little bit like a puppet show where these are the background and the foreground and then our main characters (the flowers and the bees) will be positioned in front of the background layer but behind the foreground layer.&amp;nbsp; This is a trick we can play so that the flowers look like they disappear when they reach the bottom, and we don&amp;rsquo;t have to do a bunch of funky clipping of images etc.&lt;/p&gt;
&lt;p&gt;Our &amp;ldquo;players&amp;rdquo; are a number of colored bees and flowers, and because it is quite costly to load images, rather than putting them in separate files we use something called spritemaps where all the bees exist in one single image. When we want to display a blue bee for example, we just display the first part of the bee spritemap.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/5483.beemap_5F00_4CD03CA1.png"&gt;&lt;img style="background-image: none; margin: 0px 12px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="beemap" border="0" alt="beemap" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7128.beemap_5F00_thumb_5F00_7D83444C.png" width="240" height="40" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/1732.flowermap_5F00_4A470AE3.png"&gt;&lt;img style="background-image: none; margin: 0px 12px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="flowermap" border="0" alt="flowermap" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-55-89-metablogapi/7380.flowermap_5F00_thumb_5F00_28E76547.png" width="240" height="34" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have choosen to create 4 different classes to help out with separating the code.&amp;nbsp; Column, BeePicker, Bee and Flower.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;columns &lt;/strong&gt;corespond to the blue and purple columns you see on the background, and each column contains a list of flowers that it updates and draws.&amp;nbsp; All the logic for removing and adding flowers is also contained in the columns.&lt;/p&gt;
&lt;p&gt;A &lt;strong&gt;flower &lt;/strong&gt;just has some basic information about where it is positioned and what color it is.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;beepicker&lt;/strong&gt; is the bottom area of the screen where the bees appear&amp;nbsp; and it, in turn has a list of &lt;strong&gt;bees &lt;/strong&gt;and handles the selection, updating and drawing of the bees.&lt;/p&gt;
&lt;p&gt;Similar to the flowers, the &lt;strong&gt;bees&lt;/strong&gt; have a color.&lt;/p&gt;
&lt;p&gt;If you want to follow along you can download the images above, you are welcome to use them in demos or samples, but I would like to kindly ask that you put a note in about where you got them if you do so.&lt;/p&gt;
&lt;h2&gt;Setting up the projects and importing the assets&lt;/h2&gt;
&lt;p&gt;1. Download the developer tools for Windows Phone from &lt;a href="http://create.msdn.com"&gt;http://create.msdn.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. Create a Visual C#/XNA Game Studio 4.0/Windows Phone Game project&lt;/p&gt;
&lt;p&gt;3. In the content project that is created along with the game project, drop the images. (you can see this project in the solution explorer)&lt;/p&gt;
&lt;p&gt;as soon as you have dropped them there the XNA content pipeline has turned them into Texture assets that we can use in the project.&amp;nbsp; No matter if you drop a jpg, a bmp or a png, the content pipeline will know what to do with it and turn it into a Texture2D, so you dont have to worry about dealing with different file formats in your code.&lt;/p&gt;
&lt;p&gt;In the next article we&amp;rsquo;ll get started by drawing the backdrop for the game.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10276516" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/tess/archive/tags/XNA/">XNA</category><category domain="http://blogs.msdn.com/b/tess/archive/tags/Windows+Phone/">Windows Phone</category></item></channel></rss>