Hi all, I think this should be a fairly simple problem, but I have been staring at my screen for half an hour trying to figure out what's wrong and nothing is coming to me.
So I have an entity manager (it's std::map, if it matters) that calls Update() on all of the entities I've added into it.
I'm writing a subclass of Entities called GlobEntity, and I'd like to add on to the default Update() function. In other words, call Entities::Update() and then do additional work. For some reason, when my entity manager Update()'s, it is reverting to the base class's Update(). I checked to make sure my return type, parameters, etc. were all matching, so I just don't know quite what's wrong. Here are small snippets:
int GlobEntity::Update(float gravAcceleration, sf::Vector2f centerOfMap)
{
Entities::Update(gravAcceleration, centerOfMap);
std::cout << "got here" << std::endl;
//stuff I want to add.
return 0;
}
and here's the base class's Update() function:
1 2 3 4 5 6 7
int Entities::Update(float gravAcceleration, sf::Vector2f centerOfMap)
{
//doesn't really matter what's in here, just showing you the parameters,
//return type, and function name are the same.
return 0;
}
The "got here" in GlobEntity is not showing up. Any thoughts?
@iHutch. Awesome, I will give that a shot. That would make sense, of course.
Edit: Yup! That did it. I knew it would be a simple answer. Thank you so much! I still have much to learn it seems...
@vlad. Lol. If it's a serious question, it's just my way of knowing that that specific Update() function had been called. Doesn't mean anything.