Errata

Learning XNA 3.0

Errata for Learning XNA 3.0

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page 13
Figure 2-1

In Figure 2-1 "Lifecycle of an XNA game," the method should be "UnloadContent()" instead of "UploadContent()"

Anonymous  Feb 04, 2009 
PDF Page 20
Last paragraph before sample code

The last sentences refer to the variable "texture" as a "Texture2" variable while they are actually "Texture2D" variables.

Anonymous  Feb 04, 2009 
Printed Page 22
in LoadContent()

(@"Imageslogo") should read (@"Images/logo")
and
(@Imageslogo_trans") should read (@Images/logo_trans")

Neil Wise  Oct 06, 2009 
PDF Page 64
Code example

Near the bottom of the code, in the code block for gamepad input, the code as is:
inputDirection.Y += gamepadState.ThumbSticks.Left.Y;

This will cause the three rings to move left when the stick is pushed right and vice versa. The code should read:
inputDirection.Y += gamepadState.ThumbSticks.Left.Y * -1;

Kaz Walker  Dec 26, 2009 
Printed Page 84
First piece of code

Before the code sample, it is written that "...the following code will play the start cue" when it actually plays the track cue.

Joona Luodonp  Oct 10, 2009 
Printed Page 86
8

I?m not sure if this error occurs because I?m using XNA 3.1 and the book is for the version 3.0 but if I write:

SoundEffectInstance soundEffectInstance = soundEffect.play();

a compilation error occurs telling Error 1 Cannot implicitly convert type 'bool' to 'Microsoft.Xna.Framework.Audio.SoundEffectInstance'

If I just write:

soundEffect.play();

it just work fine.

Please check this and in case you?re planning to write Learning XNA 3.1 take this into account.

Greets!

Arturo Nereu  Jul 07, 2009 
Printed Page 104
3rd paragraph

At the end of the paragraph is a parenthesis that says ...(because the sprite will only be moving in the X or the Y direction, not both).

This is an error as the sprites move diagonally towards the player sprite, they do indeed move in both the X and Y directions at the same time.

Because of this it is also unclear why the
float speedVal = Math.Max(Math.Abs(speed.X), Math.Abs(speed.Y));
is needed to determine whether to move in the X-direction or the Y-direction. It only sets the speed to the biggest of the two speed values submitted at instantiation of the object Chasing Sprite.

This is also referred to on the previous page, 103, in the coding part, Update() method, second paragraph, comments.

Best regards,
Kim Restad

Kim Restad  Sep 17, 2010 
PDF Page 133
In code, after //Reset spawn timer

The code

// Reset spawn timer
nextSpawnTime = ((Game1)Game).GetRandom.Next(
((Game1)Game).EnemySpawnMinMilliseconds,
((Game1)Game).EnemySpawnMaxMilliseconds);

which is said to reset the spawn timer is not the code that has been developed previously. The object GetRandom does not exist in Game1 at this point, nor do the variables used as the Next method arguments. Instead, the method ResetSpawnTime() - which uses the rnd object in Game1 and similarly named variables to those in the erroneous code (though they are local to SpriteManager, not Game1) - is used.

davedpmccarthy  Mar 11, 2009 
Printed Page 152
5th Paragraph, 4th line

enemySpawnMinMilliseconds and enemySpawnMaxMilliseconds in the Game1 class should read:

enemySpawnMinMilliseconds and enemySpawnMaxMilliseconds in the SpriteManager class

Leonard H. Martin  Feb 20, 2010 
Printed Page 157
Paragraph 2, Line 6

"AutomatedSprite is by examining he"

should read:

"AutomatedSprite is by examining the"

Leonard H. Martin  Feb 20, 2010 
Printed Page 239
Code listing at the top of the page

The use of MathHelper.PiOver4 with the left mouse button causes the left mouse button to roll the camera to the right. The use of -MathHelper.PiOver4 with the right mouse button makes the right mouse button roll the camera to the left. These should be reversed.

Blayne Mayfield  Jul 15, 2009 
Printed Page 243
Pitch Rotation Section

When running the game it seems when you wiggle the mouse up and down for about 10 seconds in the Y direction, the mouse starts to slow down and eventually becomes unmovable. The speed of the projectiles becomes very slow as well.

Daniel Scott  Jan 11, 2012 
PDF Page 252
Final paragraph

Where the text reads
"Add the following code to the constructor of the ModelManager class"

it should read
"Add the following code to the Initialize method of the ModelManager class"

davedpmccarthy  Mar 12, 2009 
Printed Page 310
Code, 2nd new VertexElement

The VertexElementFormat is set to Single. It should be set to Vector2.

At present only the top line of pixels from a texture/image can be used for a particle colour.

If left at single there is no reason to set a random number to both the U and V cordinates as only U is used.

Link Powell  Aug 02, 2010 
Printed Page 327
Code, all code regarding Vector3 "direction"

I cant see why for a star particle (I'm fine with explosion particle) a direction is created with random values, normalised and randomised again and then the particle direction set with this; The stars do not need a direction as they are stationary.

Perhaps this instead?

Vector3 postion = new Vector3(
rnd.Next(-(int)maxPosition.X, (int)maxPosition.X),
rnd.Next(-(int)maxPosition.Y, (int)maxPosition.Y),
// maxPosition.Z is negative so used as first parameter
rnd.Next((int)maxPosition.Z, 0));

// make all vectors the same length
position.Normalize();
position *= Math.Abs(maxPosition.Z);

particles[i].position = position;


Here a similar process to that used on direction is used on position to create a hemisphere surface of star particles. This means that whether the camera is looking left, right, up or down stars will be visible and not clustered towars the sides.

I mention clustered towards the sides beacuse I noticed that the stars at present are not visible at the left of the screen when looking left etc. So I increased the max positions and increased the far clipping plane of the camera so I could always see stars. The problem with that was the a large amount of stars where viewed over a small area and where incredibly dense (due to the viewing angle / perspective). Then I realised that the apparently redundent code for the direction could be slightly tweaked for the position (replacing the existing position code).

Link Powell  Aug 02, 2010 
Printed Page 428
LoadContent() function

The parameter of Content.Load is mistypen. It loads "imageshreerings" when it should be "images\threerings".

Joona Luodonp  Oct 04, 2009 
Printed Page 438
Update code

The line
position+=direction;
in BouncingSprite duplicates the action taken by its
base.Update(gameTime, clientBounds);
since AutomatedSprite's Update also does
position+=direction;
this results in double speed motion.

Anonymous  Feb 17, 2010