Hey guys! I have a quick question that I think is a simple mess up. I am trying to make a console word game in c#, and I have different classes, and a main class that calls those classes. I first have the Player class, and the CreateCharacter class. My player class houses all of the variables that pertain to the player of the class (level, stats etc.), and my CreateCharacter class is what calls on the startup of the game, which asks the name, race, class they want the character to be. So far that is well and good, but when I call the classes I know no other way than to say: Player player = new Player(); and I believe that takes the data I got from CreateCharacter, and erases it. So my actual engine calls CreateCharacter, gets all the information, then when I call all of the variables in the engine, they come back erased. Any help is appreciated! Thanks!
Jump to Post
Could you sendin some code or some drawing of your classes structure.
It would make it much clearer.
O, and inheriting from multiple classes is not possible in C#.
Jump to Post
In terms of architecture, a common solution is to have a master Game class that holds references to all the instances of all the components that make up the current state of the game, eg a list of Players etc. The Game class instance is shared by passing it to …
All 5 RepliesReply to this topic
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.