<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Steve Maier - Developing for Universal Windows and Games</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/stevemaier/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/stevemaier/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:51:52 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Free Xamarin Cross-Platform Tools for Students</title>
      <link>https://docs.microsoft.com/archive/blogs/stevemaier/free-xamarin-cross-platform-tools-for-students</link>
      <pubDate>Wed, 05 Nov 2014 13:29:00 GMT</pubDate>
      <dc:creator><![CDATA[YsFred4]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/stevemaier/2014/11/05/free-xamarin-cross-platform-tools-for-students/</guid>
      <description><![CDATA[This article is pulled from my website: http://42base13.net/ and&nbsp;article can also be read here:...]]></description>
      <content:encoded><![CDATA[<p>This article is pulled from my website: <a href="http://42base13.net/">http://42base13.net/</a> and&nbsp;article can also be read here: <a href="http://42base13.net/free-xamarin-cross-platform-tools-for-students/">http://42base13.net/free-xamarin-cross-platform-tools-for-students/</a></p>
<p>I love using Xamarin tools for building cross platform mobile apps.&nbsp; Now, they just announced that students could now get the tools for free.</p>
<blockquote>
<p>"Today, we are pleased to announce a new student program to help make it easier than ever for students to start building the apps of their dreams with Xamarin."</p>
</blockquote>
<p>They also announced programs for educators as well as a new Xamarin Student Ambassador program.&nbsp; Read all about it and apply for this great benefit for students, educators, and schools.</p>
<p><a href="http://blog.xamarin.com/xamarin-for-students/">http://blog.xamarin.com/xamarin-for-students/</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Azure Feature - SQL Data Sync</title>
      <link>https://docs.microsoft.com/archive/blogs/stevemaier/azure-feature-sql-data-sync</link>
      <pubDate>Tue, 26 Aug 2014 09:51:00 GMT</pubDate>
      <dc:creator><![CDATA[YsFred4]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/stevemaier/2014/08/26/azure-feature-sql-data-sync/</guid>
      <description><![CDATA[This article is pulled from my website: http://42base13.net/ and&nbsp;article can also be read here:...]]></description>
      <content:encoded><![CDATA[<p>This article is pulled from my website: <a href="http://42base13.net/">http://42base13.net/</a> and&nbsp;article can also be read here: <a href="http://42base13.net/azure-feature-sql-data-sync/">http://42base13.net/azure-feature-sql-data-sync/</a></p>
<h4>Introduction</h4>
<p>I have been using Azure for many years and have a cloud service that supports my global prayer app named Thoughts and Prayers (WP, W8, iOS, Android).&nbsp; I created this years ago before Azure Mobile Services were created and made my own WCF service to use across all platforms.&nbsp; With the new Universal apps, WCF support is not available on the Windows Phone 8.1 apps.&nbsp; So I need to move over to Azure Mobile Services to support an update of the app on Windows Phone.&nbsp; The biggest issue with this is that my original service and database are located in the North Central US region of Azure.&nbsp; This region does not have Azure Mobile Services, so I have to move things over to one of the other regions to support it and I had to find a way to move my LIVE database and not affect the 22k+ users of the apps.&nbsp; The answer for this is the new SQL Data Sync feature that is in preview on Azure.</p>
<h4>Azure SQL Data Sync</h4>
<p>Taking a look at this new feature in Azure, it allows you to define a Sync group and allows you to have data sync to other SQL Azure instances or even to on-premises SQL Server databases using a Sync Agent.&nbsp; Since I was needing to move my database from the North Central&nbsp;to East region, I did not need to use the SQL Agent and created&nbsp;Sync Group to do what was needed.</p>
<p>So going into the SQL&nbsp;Database section of the older Azure&nbsp;portal, you will see at the bottom of the screen to Add Sync.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncgroup.png"><img class="alignnone  wp-image-8221" src="http://42base13.net/wp-content/uploads/2014/08/syncgroup.png" alt="syncgroup" width="234" height="119" /></a></p>
<p>In the Sync Group you will designate one database as a Hub or main database and then the others that get added will sync to the Hub.&nbsp; Start creating the group by giving it a name and a region that the Data Sync will live in.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncgroup1.png"><img class="alignnone  wp-image-8231" src="http://42base13.net/wp-content/uploads/2014/08/syncgroup1.png" alt="syncgroup1" width="437" height="298" /></a></p>
<p>The next step will be where you define the Hub or main database.&nbsp; You will need to add a username and password for the Hub database.&nbsp; You also have to select how conflicts will be resolved.&nbsp; You can choose one of the following:</p>
<p><strong>Hub Wins</strong> - any change written to the Hub database is written to the reference databases, overwriting changes in the same reference database record.</p>
<p><strong>Client Wins</strong> - changes written to the hub are overwritten by changes in reference databases, so&nbsp;the last change written to the hub is the one kept and propagated to the other databases.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncgroup2.png"><img class="alignnone  wp-image-8241" src="http://42base13.net/wp-content/uploads/2014/08/syncgroup2.png" alt="syncgroup2" width="437" height="298" /></a></p>
<p>The final page of the Data Sync wizard lets you add a reference database.&nbsp; This will be the database that you can sync to or from.&nbsp; Pick the database from the drop down.&nbsp; This means that it needs to be a database on this account, or&nbsp;it could be a Sync Agent for an on-premises database.&nbsp; The usual username and password for this database will be stored as well as the Sync Direction.&nbsp; For the Sync Direction, you can be from the following:</p>
<p><strong>Bi-Directional</strong> - changes from either the Hub or this database are synced to the other one.</p>
<p><strong>Sync to the Hub</strong> - all changes from this database will be synced to the Hub.</p>
<p><strong>Sync from the Hub</strong> - all changes from the Hub will be synced to this database.</p>
<p>The Data Sync system will use the Conflict Resolution setting from the previous page to determine what data wins and conflict.&nbsp; This means that you need to be careful about the possibility that data could get lost.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncgroup3.png"><img class="alignnone  wp-image-8361" src="http://42base13.net/wp-content/uploads/2014/08/syncgroup3.png" alt="syncgroup3" width="436" height="298" /></a></p>
<p>Now we have the Data Sync all setup, on to configuring how often it should perform the sync operation and what should sync.&nbsp; So right now we have the service setup but it is not setup to be run automatically or on a schedule.</p>
<h4>Configuring the Sync</h4>
<p>You will now see the Sync (preview) on the top menu of the SQL Database section in Azure.&nbsp; From this menu option, you can now configure the Sync feature to tell it how often and what fields to sync.</p>
<p>The first section is the references.&nbsp; This shows the main Hub database as well as all of the references.&nbsp; On the bottom you will find a button to add another reference database to this sync.&nbsp; For this example, I will keep it as a single database to sync with.&nbsp; This display also shows the direction of the data flow in the sync.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncconfig1.png"><img class="alignnone  wp-image-8381" src="http://42base13.net/wp-content/uploads/2014/08/syncconfig1.png" alt="syncconfig1" width="485" height="152" /></a></p>
<p>The next menu option for the Sync feature is Configure.&nbsp; This will allow you to set the feature to perform Automatic Sync operations and allow you to set the frequency.&nbsp; You can setup the frequency to be in minutes, hours, days, or months.&nbsp; Keep in mind that the sync operation is going to take some time, especially if the database is larger.&nbsp; Setting the frequency to be 1 minute might be too often, but this is part of a business decision for your data.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncconfig2.png"><img class="alignnone  wp-image-8391" src="http://42base13.net/wp-content/uploads/2014/08/syncconfig2.png" alt="syncconfig2" width="361" height="267" /></a></p>
<p>The next step is to setup the Sync Rules.&nbsp; This is where you will determine what fields will be synced, and what fields will not be synced.&nbsp; This shows up as a tree structure and has checkboxes for each field to select them.&nbsp; I wanted to show my data fields because there is a field that is not supported in the data sync.&nbsp; It seems that the automatic timestamp field for the records are not available for the sync since it is an automated field.&nbsp; This is a&nbsp;mobile services database and the version field is part of how those are configured.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/syncconfig3.png"><img class="alignnone size-full wp-image-8411" src="http://42base13.net/wp-content/uploads/2014/08/syncconfig3.png" alt="syncconfig3" width="748" height="452" /></a></p>
<p>The last two menu items are the properties and logs for the data sync.&nbsp; These are not needed to be setup for the sync to start working.&nbsp; At the bottom of the screen in this configuration, there are also two more buttons, Sync and Stop.&nbsp; The Sync will perform a sync operation right now and the Stop will stop one in progress.</p>
<h4>Conclusion</h4>
<p>The new Data Sync feature is a nice&nbsp;way to let you make sure that copies of your database are updated on a schedule.&nbsp; Data is important for your business and for your customers.&nbsp; There are a few things to keep in mind, the databases that you see are the ones from your own account.&nbsp; It does looks like it will support going to a different subscription under a single account, but you cannot sync to a totally different account.&nbsp; The data sync is not instant and it will take time to perform the operation, but this new preview feature is a great way to move a database, backup, and syncing with other Azure and on-premises databases.&nbsp; I am using it for my personal projects and it is something that has a lot of potential for many different databases.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Unity 2D: Sprites and Animation</title>
      <link>https://docs.microsoft.com/archive/blogs/stevemaier/unity-2d-sprites-and-animation</link>
      <pubDate>Tue, 12 Aug 2014 07:51:00 GMT</pubDate>
      <dc:creator><![CDATA[YsFred4]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/stevemaier/2014/08/12/unity-2d-sprites-and-animation/</guid>
      <description><![CDATA[This article is pulled from my website: http://42base13.net/ and&nbsp;article can also be read here:...]]></description>
      <content:encoded><![CDATA[<p>This article is pulled from my website: <a href="http://42base13.net/">http://42base13.net/</a> and&nbsp;article can also be read here: <a href="http://42base13.net/unity-2d-animation/">http://42base13.net/<span id="editable-post-name" title="Click to edit this part of the permalink">unity-2d-animation</span>/</a></p>
<h2>Introduction</h2>
<p>People have asked me for a series of posts on Unity 2D to help them get started.&nbsp; This tutorial series will go into a starters guide to Unity 2D for making simple games.&nbsp; Years ago, I did an article for <a href="http://CodeProject.com">CodeProject.com</a> called <a href="http://www.codeproject.com/Articles/3522/Invasion-C-Style">Invasion C# Style</a>.&nbsp; I took an article on DirectX and C++ and converted it over to Managed DirectX.&nbsp; I am going to use the graphics from that game in this tutorial series since they are pretty decent graphics and work very well for a simple 2D game.</p>
<p><a href="http://unity3d.com/">Unity</a>&nbsp;is a cross platform game engine that has a built-in IDE for developing the game.&nbsp; It uses C#, JavaScript, and Boo for scripts and uses MonoDevelop as the built in code editor.&nbsp; Unity supports publishing to iOS, Android, Windows, BlackBerry 10, OS X, Linux, web browsers, Flash, PlayStation 3, Xbox 360, Windows 8, Windows Phone 8 and Wii U.&nbsp; There has been talk of Unity supporting Xbox One and PlayStation 4&nbsp;in the future as well.&nbsp; Unity also includes a physic engine and&nbsp;as of the 4.3 version has support for&nbsp;making 2D games.&nbsp; I have&nbsp;seen people&nbsp;make 2D games with Unity in 3D mode,&nbsp;but now it can support 2D directly.</p>
<h2>Setup / Requirements</h2>
<p>Make sure to get the latest version of Unity installed.&nbsp; At the time that I am writing this, it is 4.3.2.</p>
<p>Visual Studio 2012/2013 is used for&nbsp;publishing only.&nbsp; MonoDevelop 4 is installed and setup as the default editor for scripts.&nbsp; You can change this in Unity by Going to <em>Edit -&gt; Preferences</em> and then under External Tools you can change the External Script Editor.&nbsp; You might have to browse for the devenv.exe file to get Visual Studio 2013 to show up, but it is not hard to find.</p>
<p>To publish to the Windows 8 Store or Windows Phone Store, you will need to sign up for a <a href="http://msdn.microsoft.com/en-us/library/windows/apps/jj193592.aspx">Developer account</a>.&nbsp; You can get an account for only $19 total for access to both stores.&nbsp; If you have an <a href="http://msdn.com/">MSDN account</a>, <a href="http://www.microsoft.com/bizspark/">BizSpark</a>, or <a href="https://www.dreamspark.com/">DreamSpark </a>account, you can get into the store for free.</p>
<h2>Let's Go...</h2>
<h3>Create 2D Project</h3>
<p>When Unity is launched, a dialog pops up with two tabs Open Project and Create New Project.&nbsp; Select the Create New Project tab and enter in a name for the project.&nbsp; In the bottom left of the dialog, there is a dropdown for selecting 3D or 2D for the project.&nbsp; Select 2D and then hit the Create button to make the project.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/UnitysetupInvasion.png"><img class="alignnone  wp-image-5881" style="width: 537px;" src="http://42base13.net/wp-content/uploads/2014/01/UnitysetupInvasion.png" alt="UnitysetupInvasion" width="701" height="307" /></a></p>
<p>The main Unity IDE will then come up.&nbsp; This will now come up with the default 2D layout.&nbsp; The lower left pane is the project pane that shows you all of the folders and the files for the project as well as the prefabs, scenes, and scripts.&nbsp; The upper left pane is the hierarchy pane for the current scene being viewed.&nbsp; The middle pane is the scene and the game pane where things can be moved and the game will run when you are debugging.&nbsp; The far right pane is the inspector pane that will show the data for the selected item from the other panes.&nbsp; The layout and position of the panes can be moved and if you select one of the options in the layer dropdown on the upper right of the window, then the positions will change.&nbsp; To go back to this layout, select Default.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/unityInvasionPanes.png"><img class="alignnone size-large wp-image-5891" src="http://42base13.net/wp-content/uploads/2014/01/unityInvasionPanes-1024x576.png" alt="unityInvasionPanes" width="1024" height="576" /></a></p>
<h3>A Bit of Organizing</h3>
<p>In the project pane, there is a folder names Assets.&nbsp; This is actually a folder in the projects folder with the name Assets.&nbsp; One thing that I like to do is to organize things a bit to make it easier to keep track of.&nbsp; By right clicking on the Assets folder or on the pane to the right that says "This folder is empty", you can go to the <em>Create -&gt; Folder</em> menu option to make folders to keep track of things. For this sample I am going to be making&nbsp;four folders, Artwork, Prefabs, Scenes, and Scripts.&nbsp; This creates these folders under the Asset folder in the project's folder.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/unityorganizing.png"><img class="alignnone size-full wp-image-5921" src="http://42base13.net/wp-content/uploads/2014/01/unityorganizing.png" alt="unityorganizing" width="356" height="239" /></a></p>
<h3>Saving the Scene</h3>
<p>One thing that helps at this point is to manually save the scene.&nbsp; Select the <em>File -&gt; Save Scene</em> menu option and then select the Scenes folder and save the scene, for this tutorial I named it MainScene.&nbsp; This will create a MainScene.unity file in the Scenes folder.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/unitysavescene.png"><img class="alignnone size-full wp-image-5931" src="http://42base13.net/wp-content/uploads/2014/01/unitysavescene.png" alt="unitysavescene" width="305" height="228" /></a></p>
<p>One thing to keep in mind working with Unity is to make sure that you&nbsp;have&nbsp;the correct scene open.&nbsp; It is easy to have the wrong one open and you think there is something wrong with your project.&nbsp; Keep this in mind.</p>
<h3>Importing Images</h3>
<p>Importing images into the project&nbsp;can be done in a few ways.&nbsp; The first way is to find the folder under the project folder where you&nbsp;want the images and just copy them into that folder.&nbsp; For this project, the Artwork folder s being used for images.&nbsp; By taking the images from the CodeProject project, those can be dropped into the Artwork folder and when Unity regains the focus, the images are imported automatically.&nbsp; The second way is to right click on the Artwork folder in the Project pane&nbsp;and use the <em>Import New Asset...</em> menu option.&nbsp; A third way is to drag and drop the images to the folder in the Project pane and they will get copied into that folder.</p>
<p>For this part of the project, I copied over the background, the player ship, the three different ufo ships and the explosion images.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionsprites.png"><img class="alignnone  wp-image-7991" src="http://42base13.net/wp-content/uploads/2014/01/invasionsprites.png" alt="invasionsprites" width="305" height="252" /></a></p>
<p>When an image is selected in the Project pane, the Inspector pane will get filled in with details on the image.&nbsp; Selecting the backdrop2 image will now give us the following information.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionbginspector.png"><img class="alignnone  wp-image-8011" src="http://42base13.net/wp-content/uploads/2014/01/invasionbginspector-300x193.png" alt="invasionbginspector" width="359" height="231" /></a></p>
<p>From this information, you can see a few things that are important.&nbsp; The first is the Texture Type.&nbsp; This will default to Sprite for all of the images that are imported.&nbsp; The Sprite Mode defaults to Single. and the Pixels To Units defaults to 100.&nbsp; If you want the image to be larger, then you can change the Pixels To Units value to a smaller number.&nbsp; The Sprint Mode will be used when we make animations.</p>
<h3>Adding Images to the Scene</h3>
<p>At this point, we have nine images imported into our project and have a project setup for 2D and a scene named MainScene, but we don't have anything being displayed at all.&nbsp; So the next step is to add our background to the scene so that we have something to see when we run the project.</p>
<p>From the Project pane, drag the backdrop2 image from the Artwork folder to the Scene pane right over the image of the camera.&nbsp;What this does is creates a GameObject named backdrop2 and adds the&nbsp;Sprite Renderer component to it.&nbsp; With the Transform component, the scale, position, and rotation can be changed for the background.&nbsp;&nbsp;One the Scene pane, the scroll wheel on the&nbsp;mouse will zoom the scene in and out to make it easier to see things.&nbsp; This same thing can be done for anything that will be static in your game, such as a HUD, backgrounds, fixed buildings, etc.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionbg.png"><img class="alignnone  wp-image-8091" src="http://42base13.net/wp-content/uploads/2014/01/invasionbg-300x188.png" alt="invasionbg" width="423" height="265" /></a></p>
<h3>Creating Animations</h3>
<p>Games can be made with just static images and no animation, of course, that would not look very professional.&nbsp; Good games have nice animations, transitions, and more.&nbsp; Obviously, we want to make a good game, so it would be good to add some animations.&nbsp; Plus, the sample project that I took the graphics from had sprite sheets for the player ship, all of the ufos, and the explosions.&nbsp; Sprite sheets are a classic way to do animation in 2D games.&nbsp;&nbsp;Unity has support built in to use sprite sheets and to create animations from those sprite sheets.&nbsp; For this example, the ship, ufo, and explosion sprites all are sprite sheets.</p>
<p>If a sprite is a sprite sheet, the sprite mode will have to be changed to Multiple and this will add a Sprite Editor button.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionmulti.png"><img class="alignnone size-medium wp-image-8031" src="http://42base13.net/wp-content/uploads/2014/01/invasionmulti-300x132.png" alt="invasionmulti" width="300" height="132" /></a></p>
<p>Going into the Sprite Editor you will see the entire sprite sheet appear in a new window.&nbsp; In the upper left corner, there is a Slice button by default.&nbsp; Clicking on this, will show a popup where the sprite will be edited into multiple images.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionedit1.png"><img class="alignnone size-medium wp-image-8041" src="http://42base13.net/wp-content/uploads/2014/01/invasionedit1-300x249.png" alt="invasionedit1" width="300" height="249" /></a></p>
<p>After changing the Type to Grid, the display will change to show you the Pixel size for each sprite in the sprite sheet.&nbsp; For the ones that included in the project, all sprites are 70x70 pixels.&nbsp; From here, click on the Slice button and it will divide up the image into sprites with the size specified.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionedit2.png"><img class="alignnone size-medium wp-image-8051" src="http://42base13.net/wp-content/uploads/2014/01/invasionedit2-300x250.png" alt="invasionedit2" width="300" height="250" /></a></p>
<p>Make sure to click on the Apply button on the upper right of this window to apply the slicing to the Sprite itself.&nbsp; I have done this a few times where forgetting the Apply button means slicing the image again.&nbsp; Do this to all of the Sprites to create multiple frame sprites that can be made into animations.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionedit3.png"><img class="alignnone size-medium wp-image-8061" src="http://42base13.net/wp-content/uploads/2014/01/invasionedit3-300x250.png" alt="invasionedit3" width="300" height="250" /></a></p>
<p>At this point, we have a background on the display with the backdrop2 sprite and all of the other sprites are setup as multiple frame sprites.&nbsp; If you expand the sprite in the&nbsp;Project pane, you will actually see all of the frames for the Sprite.&nbsp; These frames are what is going to be used to create the animation.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionframes.png"><img class="alignnone size-medium wp-image-8071" src="http://42base13.net/wp-content/uploads/2014/01/invasionframes-217x300.png" alt="invasionframes" width="217" height="300" /></a></p>
<p>Now to make the animations.&nbsp; For a given sprite, expand the sprite to see all of the separate frames.&nbsp; Select the frames and then drag them onto the Scene pane.&nbsp; This will popup a dialog to create a new animation for you.&nbsp; For the ship animation, I named it ShipAnimation.&nbsp; In the Hierarchy pane, a new object named ship_0 is created.&nbsp; This game object has the following properties when it is selected.&nbsp; Notice that the Transform and Sprite Renderer are similar to what was seen with the background for the game.&nbsp; A new component is added here for us called the Animator.&nbsp; This is the component that will animate thru all of the frames.&nbsp; From the main scene, you will only see the first frame of the animation, but if you click on the play button in the upper middle of the Unity IDE, you will be able to see the animation run.&nbsp; In this tutorial, I am not going to be going over all of the separate options in each component.&nbsp; This is left as an exercise&nbsp;for the reader.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionbgplayer.png"><img class="alignnone  wp-image-8101" src="http://42base13.net/wp-content/uploads/2014/01/invasionbgplayer-300x188.png" alt="invasionbgplayer" width="375" height="235" /></a></p>
<p>This will let us create animations for each of the sprite sheets by selecting the frames, dropping them on the scene, saving the animation file.&nbsp; So we can see all of the sprites animate when we run the project.&nbsp; Each of the sprites show up in the Hierarchy pane with the name of the first frame.&nbsp; At this point to organize things better, the names in the Hierarchy pane&nbsp;are changed.&nbsp; You will notice that the Artwork folder will have a lot of new files now.&nbsp; An Animation folder could have been created to organize this better.</p>
<p><img class="alignnone size-large wp-image-8111" src="http://42base13.net/wp-content/uploads/2014/01/invasionall-1024x690.png" alt="invasionall" width="620" height="417" /></p>
<h3>Making a Prefab</h3>
<p>Prefabs are pre-fabricated objects that have a set of properties and components that define how the object should behave.&nbsp; Prefabs can be dynamically created in&nbsp;scripts.&nbsp; To create a Prefab, just take drag the Sprite from the Hierarchy pane into the Prefab folder in the Project pane and it will create the prefab for you.&nbsp; As you do this, you will notice that the game objects that are in the scene that are prefabs are colored in blue in the Hierarchy pane instead of the standard black.&nbsp; For this examples, all of the ufos and explosions have been made into prefabs.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionprefabshier.png"><img class="alignnone  wp-image-8131" src="http://42base13.net/wp-content/uploads/2014/01/invasionprefabshier.png" alt="invasionprefabshier" width="250" height="249" /></a>&nbsp;<a href="http://42base13.net/wp-content/uploads/2014/01/invasionprefabs.png"><img class="alignnone  wp-image-8121" src="http://42base13.net/wp-content/uploads/2014/01/invasionprefabs.png" alt="invasionprefabs" width="273" height="238" /></a></p>
<p>Since we have made prefabs from all of the ufos and explosions, we can actually remove the reference to them in the Hierarchy pane.&nbsp; Once this is done, you will still see the prefabs in the Prefab folder, but the scene will not show any of the explosions or the ufos.&nbsp; To get them on the screen, we will actually use a script for this.</p>
<h3>Adding a C# Script</h3>
<p>Scripting can be done using Javascript, C#, or Boo (a Python inspired syntax).&nbsp; This will use C# since I am the most familiar with C#.&nbsp; The first thing we will need to do is to add a new empty script.&nbsp; Right click on the script folder and go to <em>Create -&gt; C# Script</em> to make a new C# script.&nbsp; This is named MainScript.&nbsp; When it is selected in the Project pane, it will actually show the entire script in the Inspector pane.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionscript.png"><img class="alignnone size-medium wp-image-8141" src="http://42base13.net/wp-content/uploads/2014/01/invasionscript-300x216.png" alt="invasionscript" width="300" height="216" /></a></p>
<p>Looking at the script, you will notice that it creates a public class using the name of the file that was created and it is derived from the MonoBehaviour class.&nbsp; There are two methods that MonoBehaviour uses, Start and Update.&nbsp; The Start method will be called when the script starts, so here you can put anything for setting things up.&nbsp; The Update method will be called once per frame to display, move things, or whatever needs to be changed every frame.</p>
<p>To get the script running in our scene we need to add a new game object to the Hierarchy pane.&nbsp; To add a new empty game object, use the <em>GameObject -&gt; Create Empty</em> menu option.&nbsp; This was renamed to MainScriptGameObject.&nbsp; Now to tie the script to this game object, just drag the MainScript object from the Project pane to the new MainScriptGameObject in the Hierarchy pane.&nbsp; This adds the script component to the game object itself.&nbsp; Another way to add the script to a game object is to use the Add Component button and select <em>Scripts -&gt; MainScript</em>.&nbsp; This second method will show you all of the scripts in your project so that you can add any script easily.</p>
<h3>Dynamically Adding Animated Sprites</h3>
<p>Up to now, we have a main C# script and just our main player ship on the screen with our space background.&nbsp; All of the other animations we changed to prefabs and are not getting displayed yet.&nbsp; The next step is to edit the script and add the other animations back onto the scene dynamically.&nbsp; This can be the first step in getting multiple enemies on the screen using the same prefab, setting up different levels, and enemy generation.&nbsp; To start the editing of the script, double click on the script in the Project pane.&nbsp; This will start up your default code editor which defaults to MonoDevelop.</p>
<p>The first thing that we need to do in the script is to create some public member variables to have the prefabs available in the script.&nbsp; Once you save the script from the editor you will see these properties for the script in the Inspector pane when the MainScriptGameObject is selected in he Hierarchy pane.</p>
<p>Many .NET developers use properties now to do more data binding, but for Unity scripts, you have to use public members instead of properties.&nbsp; Properties will not show up in the Inspector at all.&nbsp; In the Project pane, switch to the Prefabs folder and then drop and drop the prefabs that you want to use to the script member variable.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/01/invasionscript2.png"><img class="alignnone size-medium wp-image-8151" src="http://42base13.net/wp-content/uploads/2014/01/invasionscript2-300x213.png" alt="invasionscript2" width="300" height="213" /></a></p>
<p>After this, when these member variables are used in the script, the prefabs will be used.&nbsp; This makes it easy for us to add the prefabs dynamically to the scene.&nbsp; The coordinates could be from an XML file, hard coded, or from any time of data storage.&nbsp; For this example, we will hard code the positions for each animation.</p>
<p>To create an instance of the prefab, use the Instantiate method.&nbsp; This will then need the prefab to use, the Vector3 for the position of the prefab and then the Quaternion.identity as parameters.&nbsp; The following is used to show that multiple objects can be created using the same prefab in different locations.</p>
<pre class="lang:c# decode:true" title="MainScript">public class MainScript : MonoBehaviour {

    public GameObject PlayerExplode;
    public GameObject Ufo1;
    public GameObject Ufo2;
    public GameObject Ufo3;
    public GameObject Ufo1Explode;
    public GameObject Ufo2Explode;
    public GameObject Ufo3Explode;

    // Use this for initialization
    void Start () {
	Instantiate(PlayerExplode, new Vector3(0.5f, -1f), Quaternion.identity);
	Instantiate(Ufo1, new Vector3(-1.0f, 1.65f), Quaternion.identity);
	Instantiate(Ufo2, new Vector3(0f, 1.65f), Quaternion.identity);
	Instantiate(Ufo3, new Vector3(1.0f, 1.65f), Quaternion.identity);	
	Instantiate(Ufo1Explode, new Vector3(-1.0f, 0.65f), Quaternion.identity);
	Instantiate(Ufo2Explode, new Vector3(0f, 0.65f), Quaternion.identity);
	Instantiate(Ufo3Explode, new Vector3(1.0f, 0.65f), Quaternion.identity);	

	Instantiate(Ufo1, new Vector3(-2.0f, 1.65f), Quaternion.identity);
	Instantiate(Ufo1, new Vector3(-2.0f, 0.65f), Quaternion.identity);
    }
	
    // Update is called once per frame
    void Update () {
    }
}
</pre>
<p>Please keep in mind, save the script in the editor before you switch back to Unity to test your changes.&nbsp; This has happened multiple times to me and some of my students.&nbsp; It is easy to forget.&nbsp; When you switch back to Unity it will reload the script just like it loaded the files when you added them to the folders under the Project's folder.</p>
<p>After exiting and restarting Unity, the Sprites were not showing up correctly.&nbsp; This was due to the order of things being displayed.&nbsp; All of the prefabs and the PlayerShip game objects were changed to have a value of 1 for the order of being displayed with the background set at the default value of 0.</p>
<h2>Conclusion</h2>
<p>At the end of all of these steps, we have a space background scene and have some animations on the screen and some that are added dynamically with a C# script.&nbsp; This is the first step in getting your Sprites and Animations into Unity 2D to make a game.</p>
<p>This is the start of my tutorial series on Unity 2D.&nbsp; More posts will come adding functionality to the game, documenting the steps as the Invasion game is developed using Unity 2D and getting published.&nbsp; For each article, the source code will be available for download.&nbsp; Feel free to use the code for your own research and as a basis for your own games, but please do not publish my game.&nbsp; Use your creativity to make your own.</p>
<h3>Source Download</h3>
<p>The&nbsp;original sprites&nbsp;can be found in the Original Sprites folder and the full Unity Project on my GitHub project <a href="https://github.com/YsFred4/UnityInvasion">UnityInvasion</a>.&nbsp; Have fun.</p>]]></content:encoded>
    </item>
    <item>
      <title>Free Event in Buffalo on Becoming an Entrepreneur 101 for Startups and Technology Professionals</title>
      <link>https://docs.microsoft.com/archive/blogs/stevemaier/free-event-in-buffalo-on-becoming-an-entrepreneur-101-for-startups-and-technology-professionals</link>
      <pubDate>Mon, 11 Aug 2014 08:36:00 GMT</pubDate>
      <dc:creator><![CDATA[YsFred4]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/stevemaier/2014/08/11/free-event-in-buffalo-on-becoming-an-entrepreneur-101-for-startups-and-technology-professionals/</guid>
      <description><![CDATA[Are you a tech professional and always feel that you could do a better job or come up with better...]]></description>
      <content:encoded><![CDATA[<p>Are you a tech professional and always feel that you could do a better job or come up with better ideas than your management?&nbsp;&nbsp;Do you want to start your own business but can't afford the same development tools that you use at work?&nbsp; Are you a Startup and are worried about the costs of development tools and&nbsp;hosting?</p>
<p>Come to our free event in Buffalo, NY on Aug 14th for a full day of training and setting up your free BizSpark accounts as well as Azure for hosting, storage, and more.&nbsp; Dan Stolts and&nbsp;I are hosting this event to share our knowledge and expertise on this topic.&nbsp; And of course to give you great software and Azure cloud computing.&nbsp; Space is limited, so make sure to get your tickets today.</p>
<p>Learn blogging and marketing tips as well that can help your startup to be more successful.</p>
<p><a href="https://www.eventbrite.com/e/becoming-an-entrepreneur-101-for-startups-and-technology-professionals-tickets-12463866761">Becoming an Entrepreneur 101 for Startups and Technology Professionals</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Installing the New UnityVS Plugin</title>
      <link>https://docs.microsoft.com/archive/blogs/stevemaier/installing-the-new-unityvs-plugin</link>
      <pubDate>Fri, 08 Aug 2014 13:43:00 GMT</pubDate>
      <dc:creator><![CDATA[YsFred4]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/stevemaier/2014/08/08/installing-the-new-unityvs-plugin/</guid>
      <description><![CDATA[This article is pulled from my website: http://42base13.net/ and&nbsp;article can also be read here:...]]></description>
      <content:encoded><![CDATA[<p>This article is pulled from my website: <a href="http://42base13.net/">http://42base13.net/</a> and&nbsp;article can also be read here: <a href="http://42base13.net/installing-the-new-unityvs-plugin/">http://42base13.net/installing-the-new-unityvs-plugin/</a></p>
<h4>Introduction</h4>
<p>In a previous <a title="Microsoft acquires SyntaxTree, creator of UnityVS plugin for Visual Studio" href="http://42base13.net/microsoft-acquires-syntaxtree-creator-of-unityvs-plugin-for-visual-studio/">post</a>, I talked about the fact that Microsoft purchased SyntaxTree and that means that the plugin to allow Visual Studio to be the editor and debugger for Unity is now available for free.&nbsp; These are instructions on how to get the new plugin setup and using it.</p>
<h4>Installing</h4>
<p>There were a few things that needed to be addressed in the plugin before it was released, but now it is available in the Visual Studio Gallery.&nbsp; In Visual Studio 2013, go to Tools -&gt; Extensions and Updates.&nbsp; Go to the Online section and to Visual Studio Gallery.&nbsp; As I write this, the plugin is the top plugin, but if it is not, then just search for Visual Studio 2013 Tools for Unity.</p>
<p><a href="http://42base13.net/wp-content/uploads/2014/08/nuget_unity.png"><img class="alignnone size-large wp-image-7951" src="http://42base13.net/wp-content/uploads/2014/08/nuget_unity-1024x707.png" alt="nuget_unity" width="620" height="428" /></a></p>
<h4>On to Unity</h4>
<p>So at this point when you start Unity up and add a new script file, you will find that the default editor is now.... still MonoDevelop.&nbsp; If you manually changed the editor in the Preferences in Unity to Visual Studio then set it back to MonoDevelop.&nbsp; You might see a UnityVS.OpenFile option and that is the one that will allow you to use Visual Studio 2013, if you do not see it, don't worry.</p>
<p>When you have a project up, Right Click on the Assets on the Project Pane.&nbsp; From this menu, click on Import Package.&nbsp; You will see in the Import Package menu the new option of Visual Studio 2013 Tools.&nbsp; This will add a UnityVS Folder to your project.</p>
<p>When you open up a script file, Visual Studio is now the default editor.&nbsp; You get all of the Intellisence and other VS features.&nbsp; One thing that you will notice is the button to run your program in debug or release is now showing something else.&nbsp; The options for the button are now set to "<em>Attach to Unity</em>" or "<em>Attach to Unity and Play</em>".&nbsp; The first one will just attach the debugger to Unity and then you have to play your scene yourself.&nbsp; The second option will do the same but it will play the current scene.&nbsp; Any breakpoint that is set, will be stopped at now.</p>
<h4>Conclusion</h4>
<p>UnityVS is a&nbsp;great tool to help people that&nbsp;use Unity 3D&nbsp;to be able to use Visual Studio for editing and debugging.&nbsp; This means the tool that developers normally use is what they can use for all of their scripting work in Unity.&nbsp; MonoDevelop is not a bad tool, but now it is easy and free to use the best coding IDE for your game development - Visual Studio.</p>]]></content:encoded>
    </item>
    <item>
      <title>Helping Your App Monetization with AdDuplex</title>
      <link>https://docs.microsoft.com/archive/blogs/stevemaier/helping-your-app-monetization-with-adduplex</link>
      <pubDate>Wed, 23 Jul 2014 22:08:00 GMT</pubDate>
      <dc:creator><![CDATA[YsFred4]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/stevemaier/2014/07/23/helping-your-app-monetization-with-adduplex/</guid>
      <description><![CDATA[This article is pulled from my website: http://42base13.net/ and&nbsp;article can also be read here:...]]></description>
      <content:encoded><![CDATA[<p>This article is pulled from my website: <a href="http://42base13.net/">http://42base13.net/</a> and&nbsp;article can also be read here: <a href="http://42base13.net/helping-your-app-monetization-with-adduplex">http://42base13.net/helping-your-app-monetization-with-adduplex</a></p>
<h4>Introduction</h4>
<p>I have quite a few apps that are in the Windows 8 and Windows Phone stores.&nbsp; For some of the free ones, I use <a href="http://pubcenter.microsoft.com/">PubCenter</a> to place ads in the app.&nbsp; There are some things that you can do to help out with your revenue and one of them is to use&nbsp;<a href="http://adduplex.com/">AdDuplex</a>.</p>
<h4>Advertising Primer for Developers</h4>
<p>Most modern ad systems for mobile apps use a system that pays for the ads shown instead of just paying for the ads that are clicked on.&nbsp; Each company has a slightly different formula for calculating the money that people will get but they all use the value of eCPM.&nbsp; eCPM stands for effective cost per one thousand impressions, or cost per "Mille," which is Latin for thousand.&nbsp; Clicks on ads can change things, but the overall idea is that you get the eCPM amount per thousand ads you show.&nbsp; Overall, this works well, except for a few problems.&nbsp; You can request an ad for your app and if there is not one to show, then it will return an error.&nbsp; This is called the fill rate.&nbsp; The number of ads shown divided by the number of apps requested.&nbsp; I have seen ad systems give fill rates from 10% up to 100%.&nbsp; It might be that for the country that the person is in, there might not be any ads available.&nbsp; If this is the case you will always get a fill rate of 0%.</p>
<h5>AdRotators</h5>
<p>AdRotators are a nice thing to use to help with the issue of not getting ads.&nbsp; The basic idea is that if it cannot get an ad from one system it will ask another system for an ad.&nbsp; The better rotators will look at the long term eCPM values from the various ad systems and pick the one that will give you the most money.&nbsp; This way it can optimize all of the ad revenue that you could get.</p>
<h4>AdDuplex</h4>
<p><a href="http://adduplex.com/">AdDuplex</a> is a system that will provide you with a 100% fill rate.&nbsp; But what it does not do is actually pay you for the ads that you show in your app.&nbsp; What it does instead of paying you for ads shown, it actually shows ads for your app.&nbsp; For every 100 ads that you show, it will show 80 ads for your app.&nbsp; This is basically an ad swapping system but you can also do paid ad campaigns as well.&nbsp; The extra 20% of the ads are used for the paid campaigns.&nbsp; I am running a paid campaign for my <a title="New App &ndash; HacknSlash" href="http://42base13.net/new-app-hacknslash/">Windows 8 version of HacknSlash</a>.&nbsp; I will post later on the success of the campaign.</p>
<p>The nice thing about adding AdDuplex to the mix of ad systems is that it will always be 100% fill rate since they will always have an ad to show up.&nbsp; And with this you also get ads for your app shown.&nbsp; This can mean more downloads.&nbsp; AdDuplex even has <a href="http://blog.adduplex.com/2014/01/how-to-integrate-adduplex-into-unity3d.html">instructions on how to add it into a Unity 3D game</a>.</p>
<h4>Coding</h4>
<p>This example is going to be using Windows Phone to show all of the code that I use for adding&nbsp;AdDuplex to an app.</p>
<pre style="background: white; color: black; font-family: Consolas; font-size: 13px;"><span style="color: blue;">xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.WindowsPhone" &lt;</span><span style="color: #a31515;">my</span><span style="color: blue;">:</span><span style="color: #a31515;">AdControl</span><span style="color: red;">&nbsp;AdUnitId</span><span style="color: blue;">=</span><span style="color: blue;">"&lt;pubcenter ad id&gt;"</span><span style="color: red;">&nbsp;</span><span style="color: red;">ApplicationId</span><span style="color: blue;">=</span><span style="color: blue;">"&lt;pubcenter app id&gt;"</span><span style="color: red;">&nbsp;Height</span><span style="color: blue;">=</span><span style="color: blue;">"80"</span><span style="color: red;">&nbsp;HorizontalAlignment</span><span style="color: blue;">=</span><span style="color: blue;">"Left"</span><span style="color: red;">&nbsp;IsAutoRefreshEnabled</span><span style="color: blue;">=</span><span style="color: blue;">"True"</span>&nbsp;<span style="color: red;">&nbsp;Name</span><span style="color: blue;">=</span><span style="color: blue;">"adControl1"</span><span style="color: red;">&nbsp;VerticalAlignment</span><span style="color: blue;">=</span><span style="color: blue;">"Top"</span><span style="color: red;">&nbsp;Width</span><span style="color: blue;">=</span><span style="color: blue;">"480"</span><span style="color: blue;">&nbsp;/&gt;</span>
<span style="color: blue;">&lt;</span><span style="color: #a31515;">adduplex</span><span style="color: blue;">:</span><span style="color: #a31515;">AdControl</span><span style="color: red;">&nbsp;x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">=</span><span style="color: blue;">"adDuplexAd"</span><span style="color: red;">&nbsp;Visibility</span><span style="color: blue;">=</span><span style="color: blue;">"Collapsed"</span><span style="color: red;">&nbsp;AppId</span><span style="color: blue;">=</span><span style="color: blue;">"&lt;adduplex app id&gt;"</span><span style="color: blue;">&nbsp;/&gt;</span>
</pre>
<p>This shows the original&nbsp;PubCenter ad control as well as the new&nbsp;AdDuplex control.&nbsp; The idea is to&nbsp;use PubCenter first and then if there is an error getting an ad from PubCenter, then collapse the PubCenter control and enable the AdDuplex one.</p>
<p>If the _Loaded method for the page, add the following code to tie into successful and unsuccessful ad refreshing.</p>
<pre style="background: white; color: black; font-family: Consolas; font-size: 13px;">adControl1.ErrorOccurred&nbsp;+=&nbsp;adControl1_ErrorOccurred;
adControl1.AdRefreshed&nbsp;+=&nbsp;adControl1_AdRefreshed;
</pre>
<p>For these two methods, when the PubCenter control gets an add, then show the PubCenter control and hide the AdDuplex one.&nbsp; And when there is an error getting an ad, such as when there is no ad for the location, then show the AdDuplex control.</p>
<pre style="background: white; color: black; font-family: Consolas; font-size: 13px;"><span style="color: blue;">void</span>&nbsp;adControl1_AdRefreshed(<span style="color: blue;">object</span>&nbsp;sender,&nbsp;<span style="color: #2b91af;">EventArgs</span>&nbsp;e)
{
&nbsp;&nbsp;&nbsp;&nbsp;adControl1.Visibility&nbsp;=&nbsp;System.Windows.<span style="color: #2b91af;">Visibility</span>.Visible;
&nbsp;&nbsp;&nbsp;&nbsp;adDuplexAd.Visibility&nbsp;=&nbsp;System.Windows.<span style="color: #2b91af;">Visibility</span>.Collapsed;
}
 
<span style="color: blue;">void</span>&nbsp;adControl1_ErrorOccurred(<span style="color: blue;">object</span>&nbsp;sender,&nbsp;Microsoft.Advertising.<span style="color: #2b91af;">AdErrorEventArgs</span>&nbsp;e)
{
&nbsp;&nbsp;&nbsp;&nbsp;adControl1.Visibility&nbsp;=&nbsp;System.Windows.<span style="color: #2b91af;">Visibility</span>.Collapsed;
&nbsp;&nbsp;&nbsp;&nbsp;adDuplexAd.Visibility&nbsp;=&nbsp;System.Windows.<span style="color: #2b91af;">Visibility</span>.Visible;
}
</pre>
<p>Keep in mind that for&nbsp;a Universal app there is a new version of AdDuplex that is available from the Visual Studio Gallery from <a href="http://visualstudiogallery.msdn.microsoft.com/92f919ee-40a8-4549-8768-d3b453ceebea">here</a>.&nbsp; Make sure that you get at least the&nbsp;8.5.0.4 version.&nbsp; This one has a quick fix for the control thinking that it was being instantiated behind other controls.</p>
<h4>Conclusion</h4>
<p>Overall,&nbsp;<a href="http://adduplex.com/">AdDuplex</a>&nbsp;lets you advertise your app just by showing ads in your own app.&nbsp; This means that the times when no ads were going to be shown anyways, there will be an ad shown and a benefit for you as a developers.&nbsp; Another benefit to this is that once you get many ads showing in your app, you can also give the ad impressions for that app to one of your other apps.&nbsp; This way you can advertise a new app and get many more impressions shown for the new app even tho it does not have many downloads yet.&nbsp; The limitation of this is that you cannot go from the Windows Store to a Windows Phone app.&nbsp; You can only show other apps of the same platform.&nbsp; This might change in the future with the Windows 8 and Windows Phone stores merging gradually.</p>]]></content:encoded>
    </item>
  </channel>
</rss>