Skip to Content
Learning XNA 3.0
book

Learning XNA 3.0

by Aaron Reed
November 2008
Beginner
510 pages
16h 24m
English
O'Reilly Media, Inc.
Content preview from Learning XNA 3.0

Chapter 2: Fun with Sprites

Quiz Answers

  1. What are the steps in an XNA game loop?

    • The XNA game loop consists of only two methods: Update and Draw.

  2. If you wanted to load a Texture2D object, in which method should you do that?

    • LoadContent.

  3. What line of code should you use to change the framerate of an XNA game to 20 fps?

    • Either of these lines will do the trick:

      TargetElapsedTime = TimeSpan.FromMilliseconds(50);
      TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 50);
  4. What should you pass in as the parameter of Content.Load when loading a Texture2D object?

    • The asset name of the texture image you want to load. You can find an image's asset name by viewing its properties in Solution Explorer.

  5. Fact or fiction: the content pipeline will let you know at compile time if you add an image to your project that it cannot parse.

    • Fact. The content pipeline runs a compilation step on all content (textures, models, sounds, etc.) and then outputs the result as an XNA-compatible formatted object. If this step fails during compilation, the result is a compilation error.

  6. You're drawing a sprite, and you want the background to be transparent. What steps do you need to take to draw it with a transparent background?

    • There are two ways to draw transparent images in XNA. The first option has two requirements. First, the background of your image itself must be transparent. If it isn't, you'll need to edit the image in an image editor and give it a transparent background. Second, SpriteBlendMode.AlphaBlend must be used (this is ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning XNA 4.0

Learning XNA 4.0

Aaron Reed

Publisher Resources

ISBN: 9780596154905Errata Page