M
mb
what is the best way to do this:
In a game I want to a class called "Items". This class will have the game
items
public class Items
{
public int Chair
public int Table
. . .and so on . . .
}
Then I want each item in the Items class to have properties like X and Y for
location.
The reason I want it like this is so I can instantiate a Items type,
randomly pick one of it's items then place it on the board (or get its name,
color, or material etc.).
I thought C# would give me some advantages over VB6 when I just used a
multi-demensional array MyItems(20,20), where the first number is the
item, and the second number was its list of properties. I would make
constants like CHAIR, and NAME:
Example
MyItems(CHAIR, NAME) = "Red Chair"
When I saw C# and its ability to make objects, I though this would eliminate
this need. However, it seems that I am going to have to make a
multidemensional array again. Isn't there an easier way with C#?
In a game I want to a class called "Items". This class will have the game
items
public class Items
{
public int Chair
public int Table
. . .and so on . . .
}
Then I want each item in the Items class to have properties like X and Y for
location.
The reason I want it like this is so I can instantiate a Items type,
randomly pick one of it's items then place it on the board (or get its name,
color, or material etc.).
I thought C# would give me some advantages over VB6 when I just used a
multi-demensional array MyItems(20,20), where the first number is the
item, and the second number was its list of properties. I would make
constants like CHAIR, and NAME:
Example
MyItems(CHAIR, NAME) = "Red Chair"
When I saw C# and its ability to make objects, I though this would eliminate
this need. However, it seems that I am going to have to make a
multidemensional array again. Isn't there an easier way with C#?