Thursday, 15 April 2010

ios - Get texture name from a Node - Swift/Spritekit -



ios - Get texture name from a Node - Swift/Spritekit -

i got animation of blocks changing colors, when there's click in block, color animation stops , want color block stopped.

i noticed skspritenode have sktexture attribute, can't reference calling:

node.texture

i error node not have membed named 'texture', in debugger texture there:

<skspritenode> name:'(null)' texture:[<sktexture> 'orange@2x.png' (40 x 40)] position: {604.6412353515625, 205.83619689941406} size:{20, 20} rotation:0.0

i want 'orange@2x.png' name of node, can compare later.

you have node sknode, doesn't have texture property. should able utilize optional binding cast skspritenode, this:

if allow spritenode = node as? skspritenode { println(spritenode.texture) }

ios swift sprite-kit

No comments:

Post a Comment