ios - Sprites are removed by themselfs as soon as they pass the screen height -
ios - Sprites are removed by themselfs as soon as they pass the screen height -
i'm trying spritekit first time , using actions. under impression every node/sprite create need remove reason removed themselfs pass screen height. normal behavior in spritekit?
here code. i'm using action animate sprite across screen (from bottom top in protrait-mode), funny thing node count stays @ 0 no matter how many sprites create, counts them subtracts them pass screen height.
-(void) shoot { bullet = [skspritenode spritenodewithimagenamed:@"bullet"]; bullet.position = cgpointmake(airplane.position.x, airplane.position.y + 50); [self addchild:bullet]; skaction *movebullet = [skaction moveto:cgpointmake(airplane.position.x, self.size.height + 20) duration:0.5]; [bullet runaction:movebullet]; }
if alter action sprite doesn't cross screen height node count keeps count.
change line...
skaction *movebullet = [skaction moveto:cgpointmake(airplane.position.x, self.size.height + 20) duration:0.5];
...
skaction *movebullet = [skaction moveto:cgpointmake(airplane.position.x, self.size.height) duration:0.5];
again normal behavior in spritekit?
thanks lot
the node count displayed on lower right corner indication of nodes beingness rendered on screen. not indication of total nodes in scene.
use next code
[skview setvalue:@(yes) forkey:@"_showscullednodesinnodecount"];
at same place call
skview.showsfps = yes; skview.showsnodecount = yes;
also, please have @ answer.
ios sprite-kit skaction
Comments
Post a Comment