TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
James Kurth
NA
3
0
help with object instantiation and array classes
Oct 5 2008 1:31 PM
I am having problems trying to build and debug my program. Here is what I have that causes me errors:
class NpcData
{
public int X; // actual X coordinate
public int Y; // actual Y coordinate
public byte pathMovement;
public byte pathMarker;
public float frameDelay;
public string[] speech = new string[4];
public string name;
public Texture2D visual;
}
And in my main() function, I declare it as this:
NpcData[] player = new NpcData[2];
However, in my other classes and methods, the first instance my application executes a command like:
player[0].name = "my Name";
Results in an error stating: Object reference not set to an instance of an object.
Tips: use the "new" keyword to create an object instance.
Is there something I am missing? I am using XNA 2.0 if that helps any.
Thanks
Reply
Answers (
2
)
debugging release version build issue in managed code
sql date comparaison