- 7 Tem 2013
- 8,187
- 633
What Are We Building?
[FONT="]Heres what the game looked like in the original XNA version:[/FONT]
[FONT="]
[/FONT]
[FONT="]We wont go through adding all of these features, but well get close! [/FONT]
Adding the Assets
[FONT="]Unless youre creating the next great text-based adventure, youll probably need some images and sounds. In our case, were using ones already created in the "Catapult Wars Lab" 2D sample game. This tutorial was developed for XNA, but we want JavaScript, so lets grab the graphics and sounds and get coding![/FONT]
[FONT="]
[/FONT]
[FONT="]
[/FONT]
[FONT="]Now that we have some assets, lets put them to use.[/FONT]
The Splash Screen & Logos
[FONT="]Notice that when you run the game, you first see an "X" in a square? Thats the splash screen, by default showing the /images/splashscreen.png image, but we can do better. To adjust the splash screen, double-click the package.appxmanifest:[/FONT]
[FONT="]
[/FONT]
[FONT="]The file /images/Backgrounds/gameplay_screen.png is what we want to use, but the image must be 620x300 pixels. So, open the image in your favorite editor, resize and save as "title_screen_620x300.png". Add that new file into the project.[/FONT]
[FONT="]Now we can set the "Splash screen" field to images\Backgrounds\title_screen_620x300.png. While were here, pick whatever background color youd like to complement the image (e.g. "darkGray"). Now when run, the game greets us with a new splash screen:[/FONT]
[FONT="]
[/FONT]
[FONT="]We can also adjust the apps tile, which by default looks like this:[/FONT]
[FONT="]
[/FONT]
[FONT="]Also in the app manifest, we see a number of places for logos. We can add 150x150, 310x150, and 30x30 logos for use in various places.[/FONT]
[FONT="]
[/FONT]
[FONT="]Now we have square and wide format custom tiles:[/FONT]
[FONT="]
[/FONT]
[FONT="]Looks good! Now if only we had a game to play ...[/FONT]
[FONT="]Heres what the game looked like in the original XNA version:[/FONT]
[FONT="]
[FONT="]We wont go through adding all of these features, but well get close! [/FONT]
Adding the Assets
[FONT="]Unless youre creating the next great text-based adventure, youll probably need some images and sounds. In our case, were using ones already created in the "Catapult Wars Lab" 2D sample game. This tutorial was developed for XNA, but we want JavaScript, so lets grab the graphics and sounds and get coding![/FONT]
[FONT="]
- Launch Visual Studio 2012 and create a project named "CatapultWars", using the "Blank App" template from the JavaScript > "Windows Metro style" templates.
- Download and extract the "Catapult Wars Lab" sample (CatapultWars_4_0.zip)
- From a Windows Explorer view of the folder, select and drag all four folders from the /Assets/Media/Textures folder and in Visual Studio, place them under the images folder. (This will copy and add them to the project.)
- Create a new folder called "sounds" in the root of the project.
- Copy the files from /Assets/Media/Sounds to the new "sounds" folder.
[FONT="]
[FONT="]Now that we have some assets, lets put them to use.[/FONT]
The Splash Screen & Logos
[FONT="]Notice that when you run the game, you first see an "X" in a square? Thats the splash screen, by default showing the /images/splashscreen.png image, but we can do better. To adjust the splash screen, double-click the package.appxmanifest:[/FONT]
[FONT="]
[FONT="]The file /images/Backgrounds/gameplay_screen.png is what we want to use, but the image must be 620x300 pixels. So, open the image in your favorite editor, resize and save as "title_screen_620x300.png". Add that new file into the project.[/FONT]
[FONT="]Now we can set the "Splash screen" field to images\Backgrounds\title_screen_620x300.png. While were here, pick whatever background color youd like to complement the image (e.g. "darkGray"). Now when run, the game greets us with a new splash screen:[/FONT]
[FONT="]
[FONT="]We can also adjust the apps tile, which by default looks like this:[/FONT]
[FONT="]
[FONT="]Also in the app manifest, we see a number of places for logos. We can add 150x150, 310x150, and 30x30 logos for use in various places.[/FONT]
[FONT="]
[FONT="]Now we have square and wide format custom tiles:[/FONT]
[FONT="]
[FONT="]Looks good! Now if only we had a game to play ...[/FONT]