Skip to main content
3 of 3
deleted 55 characters in body; edited tags
Tetrad
  • 30.1k
  • 12
  • 96
  • 143

Actors with multiple Textures - class Hierarchy?

In my 2D side-scroller game I have a bunch of actors being drawn, each of which has a single, non-animated Texture (a png image). These actors all inherit from a base GameActor class.

I want to add some more NPC's (e.g. tanks or cannons) that have one texture that doesn't move (the base) and another that rotates to shoot at things (the gun / barrel). How should I structure my Actor class hierarchy so as to allow for this? Should I refactor my base Actor class to allow for N textures? Or should I create a brand new sort of Actor for things that need > 1 texture (and then have to manage these actors separately from 'regular' actors)? Or is there a better approach I can't see?

Thus far I've been opting to keep things as simple as possible (KISS, right?), but am not sure how to proceed.

Any pointers greatly appreciated.