XNa series (1)

Source: Internet
Author: User
This series Article They are all articles found on msdn. Add some learning notes. XNa game studio 3.0 adding game assets to your game

Demonstrates how to add a texture asset to your game. the same procedure can also be applied to model and sound assets. it is assumed that an existing windows, Xbox 360, or Zune game project is loaded in xNa game studio.

There are two ways to add a texture asset to your game, either by adding the asset file or by adding a link to the asset.

To create a game, we may first need some materials, which are about how to add materials. There are two ways to add materials:

1. Add a clip file

2. Add a clip link

Tip

Adding an existing asset to your project is quite different from adding an existing item as a link to your project. the first method creats a copy of the asset file and adds the copy to your project. adding an asset as a link stores only the path to the asset file.

Note: adding a clip file is different from adding a clip link. The former copies the clip content to the project, and the latter only maintains a path pointing to the clip.

Adding the texture asset to the game project

When you add a game asset (not as a link), xNa game studio makes a copy of the asset file and adds the copy to the content project. for this reason, adding a game asset in this manner may be most appropriate when the asset is used by onlyOneDeveloper in one project and isNotExpected to be changed.

If a clip does not need to be changed and is only for a developer, you can add the clip file directly to the project.

To add the texture asset to the game project
    1. From the Solution Explorer window, right-clickContentNode, clickAdd, And then clickExisting item.

    2. Navigate to the location of the texture, and select it.

      For this example, the asset is called bw.nebula01.tga.

    3. ClickAddButton.

      This creates a copy of the selected asset in your project.

    4. Save the solution.

Adding the texture asset as a link to the game project

Adding an asset as a link is useful if the referenced asset depends on additional external assets. it ensures that the solution always uses the latest version. for this reason, adding a game asset as a link may be most appropriate when the asset is shared with other people or other game projects, or is likely to be changed.

To add the texture asset as a link to the game project
    1. From the Solution Explorer window, right-clickContentNode, clickAdd, And then clickExisting item.

    2. Navigate to the location of the texture, and select it.

      For this example, the asset is called bw.nebula01.tga.

    3. Click the small arrow to the right ofAddButton, and then clickAdd as Link.

      This creates a reference to the selected asset (and not a copy) in your project.

    4. Save the solution.

When adding a file or a file link is different, you can select the Add button action.

Verifying the content importer

You shoshould use this procedure each time you add a game asset. This ensures that the asset will be correctly recognized and processed by the content pipeline.

Confirm content pipeline every time you add a clip, that is, confirm that the clip can be loaded correctly and effectively by xNa.

To verify the game asset will use the correct content importer
    1. After you add the asset to the solution, openPropertiesWindow to verify that you specified the correct importer and processor.

    2. To verify, right-click on the file in Solution Explorer, and then, from the context menu, clickProperties.

      For this example,Content importerIs texture-xNa framework andContent ProcessorIs texture-xNa framework.

      For more information onPropertiesWindow of a game asset, see game asset properties.

    3. Save the solution.

Main check: Content importer and content Processor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.