delete enemy

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Seraph
Posts: 68
Joined: Wed Oct 21, 2009 5:58 pm

delete enemy

Post by Seraph »

i have created an array of enemies:

enemy.push_back(smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/ninja.b3d")));

and when i kill an enemy i delete the enemy with this:

enemy.erase(i);

but why the enemy don't disappear? it is normal?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

All you're doing is removing the enemy from the array, which is your personal list of enemies... Irrlicht still has the node in its scene graph so keeps on rendering it.

When you erase it you should also call node->remove()
Image Image Image
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

yeah, you have to remove the node, then remove from list

like
enemy->remove()
enemy.erase(i);
Image
Image
Post Reply