Getting data from an actor
Posted: Sun Mar 08, 2009 1:20 pm
The way i have my actor/gameobject system in my game working, is that the actors themself only stores some data (position, health, sprite and so on). They does not update themself nor does they draw themself. I have gamelogic and rendere classes to do that.
So i can pretty easily acces a actor from the actor vector. The problem is, that i am using polymorphisem(i am pretty sure that is spelled wrong) to store different kind of actors in the same vector. That means, if i want to access a value specific to a certain kind of actor, i can't do it!
I am pretty sure im not the only one who is structuring my program in this way. So, how do you solve this problem?
So i can pretty easily acces a actor from the actor vector. The problem is, that i am using polymorphisem(i am pretty sure that is spelled wrong) to store different kind of actors in the same vector. That means, if i want to access a value specific to a certain kind of actor, i can't do it!
I am pretty sure im not the only one who is structuring my program in this way. So, how do you solve this problem?