ios - SpriteKit detect if node is removed from parent -


is there method gets called every time node deleted? or added?

along terms of touchesbegan method gets called every time touch on screen happens.

or touchesmoved method gets called when node gets touched , moved.

so there such method gets called when node gets removefromparent?

i using update method detect if node still present like:

sknode *n = [self childnodewithname: @"n"]; if (!n) {     // no n     if (life != 0)     {         [self addchild:_n);         life--;     } } 

now when ever node missing remove 1 life, , add node again.

the problem update method running fast 2 lives removed every time node removed. believe because adding node kinda slower update method. takes 2 loops on update method before detects node present again.

there no such method. can create one.

create subclass of (for example) skspritenode , override "remove" methods (or using). within method send message whichever object needs receive removal event, or send notification , register other objects receive notification. don't forget call super implementation of overridden method.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -