This tag will allow us to solely focus on the Canvas when the app is loaded.Įverything this game will have will be inside of the Canvas Tag. Last tag is the focusable its set to true. This canvas tags its own tags inside of it, background is set to light blue, name is set to “M圜anvas” key down and key up are events that will be coded in C# later on for key down we wrote OnKeyDown and for key up we wrote OnKeyUp. CANVAS is better at rendering and moving objects than a GRID so we generally use CANVAS for a when we want to make a game in WPF C# projects.
#Microsoft blend for visual studio 2017 tutorial code
We’ve deleted the GRID tag from the default XAML code and inserted the CAVAS tag. Change the height to 615 and width to 540 TITLE – inside the title tag change the name to Space Shooter Game, this will show up on the title of the window. Make the following changes to the XAML window in the bottom We can add the components we need for this game inside the XAML window. The top blank screen is the preview window and the bottom codes you see are XAML code for this window. In this tutorial it using Visual Studio 2017 version, you can use any version of your choice and it will work the same way. PNG files has really good transparency so it helps using them for the game so it looks better without over shadowing the background.Ĭreate the new project WPF C# Project in Visual Studio. From 1 – 5 PNG files are the enemy space ships, player image labelled and purple.PNG image will be used as the repeated background image for this game.
These are the game sprites we will use to make this game.