You are currently viewing the BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I have checked and I'm pretty sure the code is the same as the code I have downloaded. I still think this is something simple. If you would like me to post all the code I have entered I can do so. Thanks!
It might be the namimg convention of one of your .cs files. I think by default, you should have a file called Game1.cs(which includes your Update, Draw, Initialize methods, etc...). If so, rename it to PongGame.cs and see if that works. Or, you can just replace PongGame with Game1 on that line with the error.
It looks like you haven't created an object of type SpriteBatch yet. You are trying to call class SpriteBatch's methods using the class itself, but you cant. You have to create an object of type SpriteBatch to access the Begin(), Draw(), and End() methods. A class like a blueprint of what an object is supposed to do/contain.
To create an object from the SpriteBatch class:
SpriteBatch anyVariableName = new SpriteBatch(graphics.GraphicsDevice);
anyVariableName(the newly created object) is now an object of type SpriteBatch. Now the object can access SpriteBatch's(the class) methods.