Page 1 of 1

Checkin if a scenenode exists

Posted: Fri Sep 23, 2005 10:43 pm
by RiChArD_fLoOd
hi when i have the code
node->remove()
in my game when i check to see if it has no life but the problem is it checks it every loop so it tries to remove it more than once but it doesnt exists once its been destroyed and crashs the game, plz can any1 help

Posted: Fri Sep 23, 2005 11:13 pm
by sudi
simply check if the node exists before u check life....that should be enough
or use a list

Posted: Sat Sep 24, 2005 10:12 am
by RiChArD_fLoOd
thanks but i was wonderin how to check if it exists

Posted: Sat Sep 24, 2005 10:36 am
by Guest
check it doesn't == null/0

if(node)
node->remove().

Posted: Sat Sep 24, 2005 8:52 pm
by pfo
make sure to set the node pointer to NULL after its removed, that way if it tries to remove again, and it's already NULL, it won't.

Posted: Sun Sep 25, 2005 10:49 am
by RiChArD_fLoOd
cheers people just what i needed, i feel like a right n00b but i guess im learnin tho :)