You can use this code to flip among x-axis:

spriteNode.xScale = spriteNode.xScale *-1;

but be careful you can lose some of physicsbody's property, I highly suggest u to use xScale in this way:

spriteNodeBody =[SKNode node];
spriteNodeBody.physicsBody =[SKPhysicsBody bodyWithRectangleOfSize:spriteNode.size];
spriteNodeBody.physicsBody.categoryBitMask =CNPhysicsCategoryPlayer;
spriteNodeBody.physicsBody.collisionBitMask =CNPhysicsCategoryBall;[spriteNodeBody addChild:spriteNode];[self addChild:spriteNodeBody];

And now you can safely use:

    spriteNode.xScale = spriteNode.xScale *-1;




http://stackoverflow.com/questions/19162853/horizontally-mirror-a-skspritenode-texture
arrow
arrow
    全站熱搜

    pcwiki 發表在 痞客邦 留言(0) 人氣()