Forum > Very silly question: Entering code from book
Hi. Sorry for the delay in getting back. I've taken a quick look but I really need to know which page you are having problems with. The example code on page 37 is the entire file (UPDATE: Actually it isn't. It is just the Game World variables with the Update and Draw methods - sorry about that). If you just put that into an XNA program it will just work. (UPDATE: If you replace the Draw and Update methods with the ones shown and addd the game world variables it will just work)
Let me know how you get on.
Rob:
THANK GOD!! Boy I'm glad you're back. Anyhoo, the way I'm interpreting the structure of the book, is that you describe a topic, and then show an example of that programming that would then go into the code for that chapter. I had been approaching it that way, and had been plugging my way through, but at around page 27 I could NOT deduce where that code went. I used the downloaded complete file to figure out where to put it, but I'm just about to start a class in which I'm teaching high-schoolers with this book, and I'm looking for problems that they'll run in to, and how I'll help them through it (without telling them to look at the finished file...for obvious reasons!). When we start your book, we'll have just finished a book on "Alice," which is very step-by-step (and therefore very easy to follow), so I want to be able to understand how you've approached entering example code into the existing code -- are we intended to do it a little at a time, or just see it in it's entirety at the end of the chapter, and type it in from there? Hmmm, I think I'm rambling now due to lack of sleep! Hopefully this all makes some sense. But again, glad you're back and I look very forward to hearing from you!
Hi. I'm very pleased you are going to do some teaching with the book. I hope it goes well.
In terms of how the book works, in the early chapters I focus on the Draw and Update methods, along with the "Game World" data members. Later on I bring in the LoadContent method.
Essentially you can work on the basis that if you add the Game World declarations to the game source file and replace the Draw and Update methods with the ones in the text you will get the right results.
I reckoned that this was the best compromise between giving code that was useful and taking up too much space in the book with coding source.
I hope this helps. If you want to have a proper chat about this, feel free to send me an email (rob@robmiles.com) and we can fix something up.



Hey guys. I'm thinking I can't see the forest for the trees here, but I'm finding myself repeatedly confused as to where in the location of the code I'm supposed to place the example pieces of text. More specifically, entering new code and not just editing current code. MORE specifically, where (in Chap 2) the book references defining the color bytes, I don't see why/where to put this code in the location as it resides in the final, "example", version. In other programming books, I'm usually able to at least accomplish THIS much -- any tips?!?!