Taking it up a notch: Saying Thank You for that XBox you got for Christmas

Or for whatever reason you got that wonderful XBox.  Now make an Avatar say thank you, this will really get them talking about how mature, smart and creative.  Unless I am at the table, but I’ll keep quiet, if you bring me another piece of pumpkin pie and the good coffee, not that crud that been on the warmer for a couple of hours.  Plus, keep those babies in diapers away from me.

If you have connected to your XBox then proceed from here, if not, then read the past two blog posts, starting with how to get to the XNA Connect using the Premium Membership or Dreamspark (Dreamspark.com, you will need to sign up and prove you are a college or university student).  If you don’t have an Xbox yet, then do the one just before this, and get C# Express and XNA Game Studio on your machine.  If you are a college or university student, think about talking to the computer science advisor and change your major, but any college or university student can get access to Dreamspark.

For now, if you have XNA Game Studio and XBox connected, download: https://creators.xna.com/en-US/samples/avatarmultipleanimations, as always, take a look at the EULA.

Once you have the file unzipped or extracted, then use the following to do a really cool presentation for saying thanks, and see how easy it is to become a game developer.

 

In this example, you are going to create an AVATAR that will show just how much you appreciate your XBox!  Unfortunately, this example will NOT work if you are not connected to an XBOX 360 that has a disk drive.

Open C# Express 2008 (2010 when it is available and working with the XNA Game Studio) Then from the menu select: File-Open Project
image
Now you have to select the Microsoft Visual Studio Solution, shown below. 
image
Go ahead and press the little triangle or press F5: image
Play with the avatar, check out the little wave and celebration, now we are going to make a simple change. Your code may look like this
image
Click the Plus next to “Update and Draw”, if the code is expanded then find the line that says Draw on it, you do a ctrl+F and paste in the line below that says: protected override void Draw or you can use the navigation bar, on the right hand combo box, click the dropdown arrow and select Draw(GameTime gameTime)  image
The code will look like the following, this is the code included in the file you unzipped
 protected override void Draw(GameTime gameTime)        {            GraphicsDevice.Clear(Color.CornflowerBlue);            string message = "Playing: ";            if (animationPlaybackMode == AnimationPlaybackMode.All)            {                message += "Celebrate + Wave";            }            else if (animationPlaybackMode == AnimationPlaybackMode.Celebrate)            {                message += "Celebrate";            }            else if (animationPlaybackMode == AnimationPlaybackMode.Wave)            {                message += "Wave";            }            message += "\n(Left Shoulder Button)";            // Draw the text            spriteBatch.Begin();            spriteBatch.DrawString(font, message, new Vector2(161, 161), Color.Black);            spriteBatch.DrawString(font, message, new Vector2(160, 160), Color.White);            spriteBatch.End();            // Draw the avatar with the combined transforms            avatarRenderer.Draw(finalBoneTransforms, celebrateAnimation.Expression);            base.Draw(gameTime);        }
Here is the image from the code above, the Avatar presentation will vary: Joey-2
Copy the code below and replace the code above, make sure get the braces correct.
 protected override void Draw(GameTime gameTime)        {            GraphicsDevice.Clear(Color.Purple);            string message = "Playing: ";            if (animationPlaybackMode == AnimationPlaybackMode.All)            {                message += "Thank you for the XBOX!";            }            else if (animationPlaybackMode == AnimationPlaybackMode.Celebrate)            {                message += "Yippee!";            }            else if (animationPlaybackMode == AnimationPlaybackMode.Wave)            {                message += "I AM SOOOO HAPPY!";            }            message +=                 "\nThis is soooo AWESOME!\n\n\nPress Left Shoulder button" +                "\nto change expression\nPress Right To Change Avatar";            // Draw the text            spriteBatch.Begin();            spriteBatch.DrawString(font, message, new Vector2(161, 161), Color.Black);            spriteBatch.DrawString(font, message, new Vector2(160, 160), Color.White);            spriteBatch.End();            // Draw the avatar with the combined transforms            avatarRenderer.Draw(finalBoneTransforms, celebrateAnimation.Expression);            base.Draw(gameTime);        }
If you got the copy correct, then you should see the following, the Avatar will vary. Change the line: GraphicsDevice.Clear(Color.Purple); To Red (for an example): GraphicsDevice.Clear(Color.Red); Now get the people who gave you the XBox over to see that you are really using it.  Start talking about how you did it, and then everyone will leave you alone as they go back to cooing over the new kids. Now you can get back to GTA, Gears of War, ODST, etc. :)
Joey-3