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

My first question on this corner of Stack Exchange!

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.

My first question on this corner of Stack Exchange!

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.

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.

Tweeted twitter.com/#!/StackGameDev/status/294429959261388800
Fix typo.
Source Link

myMy first question on this corner of Stack Exchange!

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.

my first question on this corner of Stack Exchange!

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.

My first question on this corner of Stack Exchange!

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.

Source Link

Actors with multiple Textures - class Hierarchy?

my first question on this corner of Stack Exchange!

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.