On Saturday, 23 May 2020 at 09:48:57 UTC, Mike Parker wrote:
Since you're using classes, one way is to use a common base class or an interface. But assuming "parent" is the owner of the Sprite instance, you might eliminate the dependency on the parent and have it update the Sprite's position when it's updated instead of maintaining a position separately.

class Parent {
   private Sprite sprite;

   void updatePosition(int x, int y)
   {
       sprite.x = x;
       sprite.y = y;
   }
}

Thanks a lot for this. I was trying not to overcomplicate things this early in development but I think in me holding back I made things more complex then they needed to be.

Reply via email to