iphone - iOS SpriteKit animation not working -


i new ios native game development. trying create animation using frames ideal state character. following tutorial ray's website. doing fine can't see animation in working. first frame (default) visible time. debug code & it's indeed visiting blinking player method 3 frames present, nothing happening on screen.

it great if can guide/help me identify issue.

@implementation gamescene {     nsarray *_playerblinkframes; }  // player sknode *_player;  -(id)initwithsize:(cgsize)size {     if (self = [super initwithsize:size]) {          [self createplayer];     }     return self; }  - (void) createplayer {     sktextureatlas *playeranimatedatlas = [sktextureatlas atlasnamed:@"assets"];     _player = [sknode node];     skspritenode *sprite = [skspritenode spritenodewithimagenamed:@"idle"];     [_player addchild:sprite];      [sprite setname:@"ball"];      nsmutablearray *blinkframes = [nsmutablearray array];      sktexture *temp = [playeranimatedatlas texturenamed:@"idle.png"];     sktexture *temp2 = [playeranimatedatlas texturenamed:@"blink.png"];     sktexture *temp3 = [playeranimatedatlas texturenamed:@"lookright.png"];       [blinkframes addobject:temp];     [blinkframes addobject:temp2];     [blinkframes addobject:temp3];      _playerblinkframes = blinkframes;     _player.position = cgpointmake(cgrectgetmidx(self.frame), cgrectgetmidy(self.frame));     [self addchild:_player];     [self blinkingplayer]; }  -(void)blinkingplayer {     [_player runaction:[skaction repeatactionforever:                       [skaction animatewithtextures:_playerblinkframes                                        timeperframe:0.3f                                              resize:no                                             restore:yes]] withkey:@"blinkinginplaceplayer"];      return; } 

thanks.

try this:

// player skspritenode *_player;  //..// sktextureatlas *playeranimatedatlas = [sktextureatlas atlasnamed:@"assets"];  nsmutablearray *blinkframes = [nsmutablearray array];  sktexture *temp = [playeranimatedatlas texturenamed:@"idle.png"]; sktexture *temp2 = [playeranimatedatlas texturenamed:@"blink.png"]; sktexture *temp3 = [playeranimatedatlas texturenamed:@"lookright.png"];   [blinkframes addobject:temp]; [blinkframes addobject:temp2]; [blinkframes addobject:temp3];  _playerblinkframes = blinkframes;  sktexture *tempsprite = _playerblinkframes[0]; _player = [skspritenode spritenodewithtexture:tempsprite]; 

i've not tested it, think have create sknode player covered spritenode.

let me know


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -