MyObject - PatrickLuhmann/Modron_Monodrone GitHub Wiki

MyObject is a class that I am creating to represent an object that will be displayed and potentially animated.

Required Attributes

What are the required attributes of an object at creation time?Possibilities:

  1. Position (x, y). It seems reasonable for every object to have a location. However, it is possible that an object would be created before it is meant to be displayed, and thus it would not really have a position.
  2. Size (width, height). Every object needs a size. The size should be specified at creation time. With the size as a requirement, the scale parameter probably is not needed, since the class will be able to compute the scaling required to transform the supplied skin to the given size of the object.
  3. Velocity along each axis. Not all objects will move when first created, so this is probably not required at the time of creation.
  4. Skin. This one can probably go either way. Most objects will have a skin, but there is a use case for an "invisible" object that interacts with all the other objects (and thus has location, size, velocity). Would it be better to allow for skin to be optional, or have invisible objects supply a skin that is completely transparent?
  5. Scale. My first design had this as a parameter instead of an explicit size. Now I am thinking the other way. The size of the skin bitmap should be irrelevant so having that be the starting point is probably not the best way. It is probably easier for the programmer to decide upon a size than to look up the size of the bitmap and then calculate the scale factors by hand.