Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 May 2012
Offline Last Active Nov 24 2012 08:00 PM

Posts I've Made

In Topic: Any benefits to drawing textures in one spritebatch.Begin() & End() call?

21 November 2012 - 10:18 AM

Thanks! That helps a lot.

In Topic: Mouse collision: new Rectangle or move Rectangle?

11 May 2012 - 04:04 PM

Doesn't Rectangle have a Contains() method? If so, it would be simpler to use that instead of creating a rectangle of size 1 every time.

You're right, it does. I'll use that instead.

Thanks everyone!

In Topic: Creating a subclass in place of instantiating...

07 May 2012 - 01:59 AM

Thanks for the help everyone. I'm beginning to recognize the benefits to loading ships' data from a file. I admit I'm not used to working this way, but I realize storing/loading data from files an important skill to have, so it's about time I get used to it.

To answer your question, jefferytitan, all of the Ship types are the same. There won't be any differences in behavior, only properties (health, shields, etc.). The class (or classes) would be used to produce multiple instances each, as you described (e.g. 30 Fighters, 5 Dreadnoughts).

I will go with your suggestion and try using XML to supply my Ship objects with their default data.

In Topic: Creating a subclass in place of instantiating...

07 May 2012 - 12:12 AM

Thanks for the quick reply.

I'm sorry but I didn't fully understand your suggestions. It sounds like I shouldn't create sub-classes of the Ship class and instead store different ships' default values in an XML file, regardless of the class' complexity.

I'm curious, why do you recommend storing default values in an XML file? It seems more convenient to simply hard code the default values into the program.

And, is there anything bad about creating sub-classes in this case?