我正在研究(测试)游戏以学习SpriteKit试图制作我自己的纸牌游戏。雪碧未正确定位
我正在创建一个应该由SKAction移动出来的侧栏,它是自己运行的动画。我为iPhone和iPad创建了一个正确尺寸的黑色条,名为“backmenu〜iphone.png”(50p)和“backmenu〜ipad.png”(100p)。
我遇到的问题是我能够在iPhone上正确定位黑条而不是在iPad上,它被定位为低位,我无法弄清楚我做错了什么。我确实设置了锚点并将精灵放置在相同的坐标上。精灵是正确的大小。
的代码:
SKSpriteNode *menuOnMainScreen = [SKSpriteNode spriteNodeWithImageNamed:@"backmenu"];
menuOnMainScreen.anchorPoint = CGPointMake(0.0, 0.1);
menuOnMainScreen.position = CGPointMake(_menuPositionOutsideOfScreen, 0);
menuOnMainScreen.name = @"backmenu";
menuOnMainScreen.zPosition = 1000;
[self addChild:menuOnMainScreen];
SKAction *moveMenuIntoScreen = [SKAction moveTo:CGPointMake(0, 0) duration:0.3];
[menuOnMainScreen runAction:moveMenuIntoScreen];
SKSpriteNode *arrowLeft = [SKSpriteNode spriteNodeWithImageNamed:@"arrow_left"];
arrowLeft.anchorPoint = CGPointMake(0.5, 0.5);
arrowLeft.position = CGPointMake(_setWidthPositionInSideMenuCoordinate, CGRectGetMaxY(self.frame) * 0.95);
[menuOnMainScreen addChild:arrowLeft];
以下参数:
_menuPositionOutsideOfScreen = -50 iPhone上
_menuPositionOutsideOfScreen = -100 iPad上
当我运行它的代码如下,iPhone o n中的左和iPad上的权利: