Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 14 Jun 2008
Offline Last Active Oct 17 2012 01:56 AM

#4969357 Collection of Models question

Posted by on 14 August 2012 - 02:02 AM

If there is some limit on the number of objects, you could allocate a static array, and then loop through it when you need to edit / draw /etc ( just skip any of the objects / pointers that are "null" or otherwise aren't valid at the time.. )

otherwise - creating a dynamic container - vector, list, etc.. and iterate on it.. it sounds like you are getting accessviolation exception trying to go beyond bounds of the original array? or how are you trying to create the array of buffers ( or use it - where is the exception coming from ?? )

#4964214 [OOP] Two classes that can acces each other's members

Posted by on 29 July 2012 - 01:10 AM

"Player" and "Enemy" don't sound like distinct classes to me - they are "combatant"

"Combatant" has speed, position, possibly weapons, inventory, etc..

Then "Player" is a class derived from "Combatant" - uses input (keyboard,mouse, etc.) to change animations, positions, etc.

And "Enemy" is also class derived from "Combatant" - but this uses AI to drive it...

This would also allow later for AI characters to fight on either side, or possibly have multiple factions...
And networked / LAN players could be derived as well...