Go To Homepage



Book Details
Beginning XNA 2.0 Game Programming: From Novice to Professional book cover
  • By: Alexandre Santos Lobao , Bruno Pereira Evangelista , José Antonio Leal de Farias
  • ISBN10: 1-59059-924-1
  • ISBN13: 978-1-59059-924-2
  • 456 pp.
  • Published Apr 2008
  • Price: $39.99
  • eBook Price: $27.99




Errata Submission

If you think that you've found an error in Beginning XNA 2.0 Game Programming: From Novice to Professional, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.

Submit Errata
Beginning XNA 2.0 Game Programming: From Novice to Professional (978-1-59059-924-2)

Errata

Issue Author's Response
p79
To run succesfully you need to change the Draw method in Game1 from:
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}

to this:

protected override void Draw(GameTime gameTime)
{
spriteBatch.Begin();
base.Draw(gameTime);
spriteBatch.End();
}
The errata is wrong. You do not have to do such modification, and maybe te program will not work with such modification...
p63
There is no LoadGraphicsContent() but LoadContent().
That's right. LoadGraphicsContent will work only as a deprecated method, please ignore any mentions to this method in the book, considering LoadContent instead.
p59
It says "Call thismethod inside the doGameLoop() method,
after the foreach loop."
There is no doGameLoop() method; the correct one is DoGameLogic() method on the main Class.
Cheers
Fabio
Yes Fabio, you is correct.
Why ,instead of only writing "That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content." to the reader, dont you give us a proper solution? An example is "p31" the 6th person from the top who left a comment, there is no solution given. I know you are promoting your book for XNA 3.0 but what about the people who have not bought that book or the ones are not planning to buy it? Should not they get any response?
Thanks
Answers like ""That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content."" are presented only for readers that already presented a solution in this errata.
For example: "In page XX, the code that reads "spritebatch.Draw" should be "spriteBatch.DrawString".
In such cases, when the correction is already presented by the readers, the authors can only agree that his correction is right, and make sure that the next version of the book is printed without the pointed error.
If you have any specific questions that were not responded, please present them and we will gladly answer.
Chp 4 Page 89

Line: backMusic = audoComponent.GetCue("startmusic");

should be

backMusic = audoComponent.GetCue("backmusic");
The correction sugested by the reader is valid.
http://creators.xna.com/themes/default/images/
common/xna_thumbnail.png

link no longer exists in chapter 2
Yes, this link no longer works. Please substitute the image for any .JPG, TGA or PNG file you have on your hard drive.
Ch 2, pg. 21. Link to xna_thumbnail.png is no longer valid

Ch 2, pg. 22. Advice here does not work for XNA 3.0 Beta in VS 2008 Express. After adding a .png or .jpg to a solution, the properties panel doesn't show Content Importer or Processor entries. As a result, creating the clsSprite fails. I was hoping to find advice here on how to resolve in XNA 3.0.

Also, your errata doc file has one error item, but no page number where it appears!
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
Ch2 p38 - "Using Audio in Games"

This whole thing completely doesn't work.

For starters, you have to right-click Content and Add Existing Item to add your .xap file.

Next, you have to copy your wave files into the content folder, or else the program won't be able to find them.

Finally, you have to change the path names from
"MySounds.xgs"
"Wave Bank.xwb"
"Sound Bank.xsb"

to preface them all with "Content/", or you'll get FileNotFound exceptions.

What's up with this book, anyway? Not a single thing in it has worked.
Parts of the book were written with a final, but still beta, version of XNA 2.0, so some differences do arise. In the XNA 3.0 version of the book, we waited for the final version to be release, so this kind of mistakes will not happen again.
Thanks for pointing this for us.
p38

"You include audio content in the game ... by right-clicking the Solution Explorer and choosing Add New Item"

next sentence:

"Remember, when the Add Existing Item dialog box is open ..."

Add Item and Add Existing Item are two different options. Which one is the reader supposed to click on?
The correct is the "Add existing Item" option, since you just created the content outside the project, and just want to include it in the game. The correction is included in the XNA 3.0 version of the book, along with new content.
p31

"Running the code now, you'll see the sprites moving and bouncing against each other and against the window borders ..."

Actually, if you follow the steps as outlined in the chapter, you'll get mySprite2 staying still while mySprite1 bounces against it. The second sprite doesn't move because the book doesn't tell the reader to set mySprite2's velocity and call mySprite2's Move method.

Even if the reader does this, the collision does not work properly. i could only get it to work as expected by duplicating the Collides method check for mySprite2, and by setting mySprite2's velocity to something off-kilter, like Vector2(2, 3)

In fact,
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
p28

If the reader takes the book's earlier suggestion to change the PreferredBackBuffer width and height to a square (400x400), the example where the sprite bounces around the screen is a little anti-climactic. It just bounces from corner to corner.

i suggest telling the reader to set the PreferredBackBuffer to 400x300 (this may also help the reader weed out potential X/Y bugs in the code ... it's less likely that X/Y reversal errors will appear when testing boundary collisions in a square space)
Thanks for the suggestion. We will consider it in the XNA 3.0 version of the book, along with new content.
p28

You forget to tell the reader to call mySprite1's Move method in Draw. Without this, the sprite doesn't go anywhere.
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
ch1 p25

mySprite = new clsSprite(Content.Load<Texture2D>("xna_thumbnail"), new Vector2(0f, 0f), new Vector2(64f,64f));

This line of code throws the following error:

ContentLoadException was unhandled
Error loading "xna_thumbnail". File not found.

(i added xna_thumbnail.png to my project exactly as the book described)
The image file must be included in the "content" subfolder of the project, not in the project itself.

The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2
page 28
7th line from top of page should read
// checking top boundary
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2
page 21

int _gameLevel;
public static int GameLevel
{
}

code does not compile as is

_gameLevel field and GameLevel property should both be static

static int _gameLevel;
public static int GameLevel
{
}
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
I am running XNA 2.0 on Visual Studio 2005 on Windows XP.

The first problem is on page 21 on the final paragraph:

"Once you have this image in your hard drive, include it in your project by pressing the left mouse button over the Solution Explorer window, as shown in Figure 2-3, selecting Add>Existing Item, and choosing the image you just downloaded"

This process results in a contentLoadException Unhandled Error when I tried to run the program.

SOLUTION: Don't follow the Figure on page 22 or the directions on 23 if you are getting this error. Instead:

1. Right Click on the "Content" Root Directory (its also in Solution Explorer... the one with the orange-red ball and a blue rain drop)

2. NOW use Add>Existing Item...

3. Select the file you want to use as the sprite
(MAKE SURE THAT THE "Files of type" COMBO BOX IS SET TO "Texture Files")

4. Now add and you can use the file just like the book explains.

The second problem (minor):

On page 20, the text has you create a new class that uses the Vector2D and Vector2 data types. The problem is that C#.NET does not recognize these data types automatically, so it will complain endlessly.

Of course if you've programmed for a little bit you've ran into this before. The solution is to simply grab all the unique "using statements" found in the Game1.cs file and paste 'em to the top of this new class... that way C#.NET will recognize the data types and stop complaining.

Happy Coding!
David Evans

PS In my searching for a solution to this problem I found a site that suggested that this error is a result of Microsoft changing the way files are imported in XNA 2.0 after its official release. This means that the beta edition given to authors used a completely different method of importing the files. Thus the difference.

Given how these things are though, others might not have any problems with this whatsoever, but I thought I'd submit what I found in case others had the same problem I did.
Your comments are clear and right, thanks. The corrections are included in the XNA 3.0 version of the book, along with adjustments according to the new content we are including.
Chapter 2, Page 25

Where you mention changing the window size via graphics.PrefferedBackBufferWidth and graphics.PrefferedBackBufferHeight, the code change has to go into Initialize(), not LoadContent(). The window will still change size, but Game.ClientBounds will not update properly, which will cause problems with Chapter 4 during the discussion about centering the foreground image for the help scene, which is larger than the default 800 x 600 size window.

There may be other implications, but that is what led me to discover the issue (which I might add was a PITA to figure out).

As a side note, so far liking the book (obviously enough to care about submitting Errata).

Cheers!

Brad
That's right, thanks, Brad! The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2, p21

The last paragraph tells you to "download the image directly from http://creators.xna.com/themes/default/images/common/xna_thumbnail.png" as of June 25, 2008, this file path no longer works and the image no longer exists.
Then the reader is told to include the image in the project by "pressing the LEFT mouse button", when in fact, you are supposed to press the RIGHT mouse button.

on page 22, in figure 2-4, the properties in the properties window were as follows:

Asset Name
Build Action
Content Importer
Content Processor
copy to Output Directory
Fil Name
Full Path

after following the instructions in the book, the properties displayed on my computer were somewhat different:

build action
copy to output directory
custom tool
custom tool namespace
file name
full path

I am not sure whether or not this has something to do with the book, or there is a problem with the way my computer is configured. Also, after copying the code from the book into the program, the game would not build, and there was an error message that said the image file could not be found.
Thanks for your comments.
As for the image, you can just use any another image, we will fix this issue in the next version of the book.
As for the properties, the book is wrong, not your machine: the image was captured with an ealier version of XNA. The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2, Page 39
There is an error within the code.

else
GamePad.SetVibration(PlayerIndex.One, 0f, 0f);
}

Is incorrect, as a curly open brackets is required, the code should appear as follows:

else
{
GamePad.SetVibration(PlayerIndex.One, 0f, 0f);
}
There is really an extra curly bracket here. You can solve the problem as you said, or simply remove the extra bracket: since there is only one line in the "else" clause, there is no need to include it in curly brackets.

The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2: Page 28

The comment associated with the following code, should be // checking upper boundary

and not // checking bottom boundary
as shown below.

// checking bottom boundary
if (position.Y + velocity.Y < 0)
velocity.Y = -velocity.Y;

Regards.
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2: Page 26.

The example code with which to move a sprite along the X axis: mySprite1.position.X += 1;

is incorrect, and should read as:

mySprite.position.X += 1;

Regards.
That's right, thanks. The correction is included in the XNA 3.0 version of the book, along with new content.
Chapter 2, page 21: "...include it in your project by pressing the left mouse button over the Solution Explorer window..." Should be RIGHT MOUSE BUTTON

Chapter 2, pages 21 & 22: Using XNA 2.0, you have to add "Existing Items" to the "Contents" subfolder of "WindowsGame1," not "WindowsGame1" itself, otherwise Visual C# 2005 won't use the "Content Importer" and "Content Processor." Thus, the program will not start.
Both comments are totally right, thanks a lot. I included your corrections along with the new content in XNA 3.0 version of the book.