O'Reilly logo

Learning XNA 4.0 by Aaron Reed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4: User Input and Collision Detection

Quiz Answers

  1. What object is used to read input from a mouse?

    Mouse.

  2. Fact or fiction: the X and Y coordinates from a mouse as read in an XNA application represent how much the mouse has moved since the previous frame.

    Fiction. The input is given in actual screen coordinates based off the upper-left corner of the game window. To get the distance moved since the previous frame, you have to compare the value from the current frame against the value of the previous frame.

  3. What is the difference between an analog input control and a digital input control?

    A digital input yields a Boolean yes/no, on/off status, whereas an analog input gives a range of inputs based on how far the button has been pressed.

  4. Describe the bounding-box collision-detection algorithm.

    The bounding-box algorithm is a simple collision-detection algorithm in which you “draw” imaginary boxes around objects and then run collision checks on the boxes themselves to see whether any objects are colliding.

  5. Describe the pros and cons of the bounding-box collision-detection algorithm.

    The two biggest pros of the algorithm are its speed and simplicity. The biggest drawback is its inherent inaccuracy—not all objects are square or rectangular, and as such, the algorithm has accuracy issues.

  6. What is the ratio of unicorns to leprechauns?

    According to Stanley Hudson of The Office, the ratio of unicorns to leprechauns equals the ratio of Stanley nickels to Schrute bucks.

    Dwight: Don’t you want to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required