Jump to content

  • Log In with Google      Sign In   
  • Create Account


barodamike

Member Since 23 Nov 2006
Offline Last Active Jan 30 2013 12:42 PM

Topics I've Started

Drawing enemies based on position

25 January 2013 - 11:48 PM

Hi all, I'm relatively new to game programming and I'm sure there's a nice and easy way to do this so I thought I'd post here and see if I can get a concise reply before I make changes myself. The issue is I have 3 different types of enemies that I render to the screen. Unfortunately the way my code works is each type of enemy object gets stored in its own list. When it's time to draw the enemies to the screen they get rendered in the order of what kind of enemy they are because I simply draw one enemy list, draw the next enemy list and then draw the 3rd enemy list. This is not good because the 3rd enemy types are always "on top of" the first enemy types. I know there must be a way to define and interface or something where I can store the 3 different objects in one big list and sort them neatly depending on how close they are to the screen and update all their positions and so on. I tried putting them all in a list of their parent class but then I don't have access to their update methods. Help appreciated!

PARTNERS