I thought I would convert the Platformer XNA game over into PCL. I choose the default Portable Class Libraries for Windows Phone Store:
And I started importing code, the Vector2 references were easily converted to Windows.Foundation Point. Converting the Texture2D references to Windows.UI.XAML.Controls Image.Sources took a little more effort. I set up the Level files as Items (the data Item from the PCL Template), no need to get too creative here, yet. I renamed the Platformer.Tile to Platformer.PCL.Block as to avoid and confusion between them and the Windows 8 Modern Tiles.
This was going fine(ish) as I converted all the static images in the game to Image Controls. I replaced the Default grid with a Canvas. Since I don’t have a multi-touch capable monitor and I worked on a Windows 8 VM I decided to opt for a NES style game pad on the HUD of the game (along the bottom). I made the X pad and A/B buttons in Blend (which comes with VS2012). And this is basically what I had:
I did run into some issues with trying to get the spritemap to work for the hero..
XAML Spritemap animations, so the problem is that XAML and animations is typically interpreted as using an animation transform, however for character animation this will simply not work, we need to do a frame animation, not a key frame animation. So to do this we leverage a ViewBox and flip thru images… so now we need to talk about frame rate… this is where I ran into the largest hurtle. I couldn’t get the timer to work!!!