Click here to Skip to main content
15,908,112 members
Home / Discussions / C#
   

C#

 
Questionc# listview thumbnail image display problem Pin
illfar15-Jul-08 19:37
illfar15-Jul-08 19:37 
JokeRe: c# listview thumbnail image display problem Pin
luyc0407-Sep-09 22:58
luyc0407-Sep-09 22:58 
QuestionDateTime format, Sorry for Reposting Pin
Mogaambo15-Jul-08 18:42
Mogaambo15-Jul-08 18:42 
AnswerRe: DateTime format, Sorry for Reposting Pin
stancrm15-Jul-08 19:32
stancrm15-Jul-08 19:32 
Questionhttp GET Request Pin
steve_rm15-Jul-08 17:45
steve_rm15-Jul-08 17:45 
AnswerRe: http GET Request Pin
steve_rm15-Jul-08 18:21
steve_rm15-Jul-08 18:21 
GeneralRe: http GET Request Pin
leppie15-Jul-08 22:03
leppie15-Jul-08 22:03 
QuestionGenerics to reduce complexity Pin
Genbox15-Jul-08 17:31
Genbox15-Jul-08 17:31 
Hi.

I'm currently creating a game that contains a lot of characters. I'm now facing the problem of getting a very high complexity in my application because of the high number of characters.

I wanted to make a CharacterHandler that creates instances of the characters (Need to be a factory patteren of a kind, character creations need to take game difficulty into accound etc.)

this is some code from a character:

public class Bananas : NormalBrush, ILevelObject, IPointObject
{
private readonly int _collisionGroup;
private readonly float _mass;
private Body _body;
private Geom _geom;

public Bananas(Vector2 position, int collisionGroup, float mass, float scale, ContentManager contentManager)
: base(Color.White, position, contentManager.Load<texture2d>("Content/Objects/Fruits/Bananas"))
{
_collisionGroup = collisionGroup;
_mass = mass;
base.Scale = scale;
}
}

Is there a way that i can change the inheritance of the objects to simplify the creation of the characters or maybe use C# generics to do the job?

Any improvements are welcome.

EDIT: To sum it up.
Instead of doing:

CharacterHandler.CreateBananas(position);
CharacterHandler.CreateOrange(position);
CharacterHandler.CreateApple(position);

I could do something like this:

CharacterHandler<bananas>.CreateCharacter(position);
and so on.
QuestionForm &lt;-&gt; UserControl data exchange Pin
nelsonpaixao15-Jul-08 14:16
nelsonpaixao15-Jul-08 14:16 
AnswerRe: Form &lt;-&gt; UserControl data exchange Pin
Gideon Engelberth15-Jul-08 16:22
Gideon Engelberth15-Jul-08 16:22 
AnswerRe: Form &lt;-&gt; UserControl data exchange Pin
DaveyM6915-Jul-08 21:22
professionalDaveyM6915-Jul-08 21:22 
Questioncalling static struct inside another struct Pin
brigates15-Jul-08 13:06
brigates15-Jul-08 13:06 
AnswerRe: calling static struct inside another struct [modified] Pin
Colin Angus Mackay15-Jul-08 13:29
Colin Angus Mackay15-Jul-08 13:29 
AnswerRe: calling static struct inside another struct Pin
Guffa15-Jul-08 13:45
Guffa15-Jul-08 13:45 
Questioncreate object from returned Type Pin
DaveyM6915-Jul-08 12:43
professionalDaveyM6915-Jul-08 12:43 
AnswerRe: create object from returned Type Pin
Colin Angus Mackay15-Jul-08 13:30
Colin Angus Mackay15-Jul-08 13:30 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 13:45
professionalDaveyM6915-Jul-08 13:45 
AnswerRe: create object from returned Type Pin
Guffa15-Jul-08 13:57
Guffa15-Jul-08 13:57 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 14:06
professionalDaveyM6915-Jul-08 14:06 
GeneralRe: create object from returned Type Pin
Guffa15-Jul-08 14:18
Guffa15-Jul-08 14:18 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 21:47
professionalDaveyM6915-Jul-08 21:47 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 21:59
professionalDaveyM6915-Jul-08 21:59 
GeneralRe: create object from returned Type Pin
Guffa16-Jul-08 1:33
Guffa16-Jul-08 1:33 
AnswerRe: create object from returned Type [modified] Pin
DaveyM6915-Jul-08 22:13
professionalDaveyM6915-Jul-08 22:13 
GeneralRe: create object from returned Type [modified] Pin
Guffa16-Jul-08 1:37
Guffa16-Jul-08 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.