-
|
|
Xna 3.0 Book "O'reily" Questions ?
|
I got learning xna 3.0 by 0'reily about a week ago and loads of the excercises arn't wroking just coming up with errors and problems occuring i'm doing everything it says. The book is really badly layed out though as it just has code everywhere instead of like my c++ book where they put all code in each chapter for easy to see and read. I was just wondering is anyone else having problems with this book.
3D Artist & Programmer:Portfolio - Team
|
|
-
-
- (0)
-
premium membership
-
Posts
26
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Sorry, but I had exactly the opposite experience. I love this book. I thought it was well laid out, and was the best book I've seen on XNA development. I've got 2 other XNA books, and this is definitely my favorite of the three.
Hopefully this will help:
http://aaronreed.com/serenitynow/?page_id=88
At the bottom of this web-page you'll find the code samples for every chapter and example in the book.
Best of luck!
|
|
-
-
- (5798)
-
premium membership
MVP
-
Posts
3,118
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
For book specific help, we direct you to the forums often available for those books. You can glance through our FAQ where we tried to provide links to most of the book specific forum available to see if the one you're looking for is listed.
Unfortunately what you're encountering is pretty common for programming books. Books are often written (or re-written) with a newer API and and in a rush to get out so that they are still applicable for the version they were written for. This leads to code that might not work exactly as it's written and some parts that just don't make sense. Often the samples provided will need a lot of tweaking for them to actually start working.
Books are great at explaining concepts, but if you need to see the code working to understand the concept they often fail for that type of learning. Best of luck to you, don't forget about the wonderful resources online for learning to program using the XNA framework. Often they can help fill in the gaps the books leave.
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
I have it and It is great, I have had no problems
teK-Junkies: 'where one man's junk becomes another man's tek'
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Personally I liked it as well, however I think there are some problems with it. I'm sure the author makes errors on his kinematic naming conventions like calling velocity 'direction' and stuff like that.
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Ok thanks guys.
Maybe one of you guys could help me sometime really have some problems and i have done all the stuff in the book.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
I had that book and sold it when I discovered this book.
I just didnt agree with the style of coding that the O'Rielly book had to offer, its not a bad book though.
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Having problems with this chapter.
In Chapter 6: AI
I have done all the code:
http://pastebin.com/m61aaf2e4
but i'm getting a error have i put it in the wrong section.
Error: } expected
Line for error:
spriteList.Add(
new AutomatedSprite(Game.Content.Load<Texture2D>(@"Images\skullball"),
postion, new Point(75, 75), 10, new Point(0, 0),
new Point(6, 8), speed ));
player = new UserControlledSprite(
Game.Content.Load<Texture2D>(@"Images/threerings"),
Vector2.Zero, new Point(75, 75), 10, new Point(0, 0),
new Point(6, 8), new Vector2(6, 6));
Please help i really want to try get this book done.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
First, your SpawnEnemy method is declared inside of your LoadContent method. You can't do this. Second, the SpawnEnemy method doesn't have a closing '}' bracket, as the error tells you.
Did you have any C# or other programming experience before you started reading this book?
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
ok thanks.
So where would i need to declare it as it says in book to declare in load content. Also i have had 1 and a half year experience in c++ and visual basic.net so i was guessing just try and adapt to c# as it's really similar to c++.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
C# is not as similar to C++ as you might think. C++ is more of an all-rounder where-as C# is highly focused on being Object-Oriented. Also, as far as I'm aware, you can't declare/define a method inside another method in C++ or C# (probably Visual Basic as well, I wouldn't know, I've never used it). You'd probably do well to have a read through some C# tutorials:
http://www.csharp-station.com/Tutorials.aspx
http://www.c-sharpcorner.com/Beginners/
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Yah some elements of the synthx is completly different to c++ but i'm finding c# quite easy so far not completly different from c# but i will check over those tutorials see if i can learn some more tips & tricks. I have seemed to fix the code problems now and working again for the A.I chapter but after finding out i decided to go back and try fix this sound problem.
I found what the problems where and couldn't find why my sound wasn't playing on collision so i just rewrote the code instead of book and it's all working now.
Thanks.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
I'm having some more trouble with book in chapter 7: putting togeather.
Error Messages:
'Basic_A.I.Sprite' does not contain a constructor that takes '9' arguments C:\Documents and Settings\MG1\My Documents\Visual Studio 2008\Projects\Xna\Basic A.I\Basic A.I\UserControlledSprite.cs 19 15 Basic A.I
'Basic_A.I.Sprite' does not contain a constructor that takes '9' arguments C:\Documents and Settings\MG1\My Documents\Visual Studio 2008\Projects\Xna\Basic A.I\Basic A.I\EvadingSprite.cs 23 15 Basic A.I
Code:
Sprite
http://pastebin.com/m1ad64963
Automated:
http://pastebin.com/m5c7e6d73
Game1:
http://pastebin.com/m4f01fef7
Sprite manager:
http://pastebin.com/m64cafffa
Thanks please help me i donno what's wrong because the arguments should be working ok i copyed out of book.
3D Artist & Programmer:Portfolio - Team
|
|
-
-
- (15410)
-
premium membership
MVP
-
Posts
8,554
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
You're not passing the right number of arguments to the constructor. Match up the parameters in your code with the constructors for the Sprite class.
Jim Perry - Microsoft XNA MVP If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job. Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki. Please mark posts as Answers or Good Feedback when appropriate.
|
|
-
-
- (0)
-
premium membership
-
Posts
26
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
The two error messages you listed were from the classes: EvadingSprite and UserControlledSprite. However, the code that you copied into your pastebin website contained 4 other classes, not the 2 with an error.
Did you look at the website I suggested?????
http://aaronreed.com/serenitynow/?page_id=88
At the bottom of this web page are the exact code samples you need. I downloaded and ran both Chapters 6 and 7 to make sure they work, and they both do. Why don't you download those and compare them to the code that is giving you errors?
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Yes i always look there site but sometimes you don't see the small errors you make and miss it out even by looking at the other code. For some reason all i done was moved the constructors around in the sprite and they seemed to work so it's working now.
Thanks for the quick reply again.
3D Artist & Programmer:Portfolio - Team
|
|
-
-
- (3225)
-
premium membership
-
Posts
1,524
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
I liked this book best of the XNA books I've read as well...
How you like the code samples written really depends on you. Most of the time, when I am looking through samples, I just want to do one specific thing and thus it's better to have that specific thing inline with the text that talks about it. Rarely do I want to type out an entire program, which strikes me as the reason for having all the code in one place. When i was first getting into programming though, i think I probably would have liked everything in one place, as I needed help understand not only the individual pieces but how they all fit together.
|
|
-
-
- (0)
-
premium membership
-
Posts
26
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
I very much agree, Kris. Actually, one of the things I liked about the O'Reilly book was that it had the best of both worlds. The book only lists the specific things inline with what the text is talking about, but then the supporting website lists out the complete code in one place for those that need it.
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Yah i do agree with you both the book is pretty good but i would prefer more to have all code togeather that way you can just sit read loads and then write it and learn it on pc i got through my c++ book a lot quicker that way then this book took me awhile to do this book so far.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
i love this book too, and i learned a lot from it
i remember the first time I made a controller vibrate (don't worry, I won't make the 100th massage game)
I put the code into an "if" block
if (A is pressed)
then make it vibrate blah blah
.. but i forgot to put in the "else" block
else
make it stop
haha, it was going crazy, and i had to pull the USB connector of the wired controller out of my laptop
(this is how machines go crazy in Terminator right? pull the plug...! PULL THE PLUG!!!)
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Just having some problems with my game it's going really well just having this minor problem hopefully you know what's happening. Basically the game works fine but when i add the cross hair (2d) then the models go see-through in certain parts and don't render correctly check picture below.
Game1:
http://pastebin.com/m6a286715
Please help, Thanks.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
This is most likely a renderstate that you changed. Check to see which were changed right before drawing the cross-hair, and change them back after the drawing is done. Hope it helps!
|
|
-
-
- (748)
-
premium membership
-
Posts
166
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Jack Newcombe:C# is not as similar to C++ as you might think. C++ is more of an all-rounder where-as C# is highly focused on being Object-Oriented. Also, as far as I'm aware, you can't declare/define a method inside another method in C++ or C# (probably Visual Basic as well, I wouldn't know, I've never used it). You'd probably do well to have a read through some C# tutorials
I don't want to derail the thread, but you can technically put C++ functions inside a function via a struct/class (not that you'd want too...). I don't think you can do the same in C# though
| void MyRandomFunction() |
| { |
| struct Blah |
| { |
| static void DoStuff(int& x) { x++; } |
| }; |
| |
| int y = 0; |
| Blah::DoStuff(y); |
| |
| // do stuff |
| } |
PebbleDash - Released Abstacked - Released
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
Basicly it seems to be when i add the spritebatch.begin() and spritebatch.end() that the models just mess up.
3D Artist & Programmer:Portfolio - Team
|
|
-
|
|
Re: Xna 3.0 Book "O'reily" Questions ?
|
See this to fix your render states after using spritebatch so your models draw correctly again.
Game hobbyist hell-bent on coding a diabolical Matrix
|
|
|