相关疑难解决方法(0)

为什么精灵工具包中的坐标系翻转,我可以全局更改吗?

我注意到在Sprite Kit中,坐标系被翻转.

例如,这是一个SKSpriteNode:

SKSpriteNode *car = [SKSpriteNode spriteNodeWithImageNamed:@"car"];
car.position = CGPointMake(0, 0);
[road addChild:car];
Run Code Online (Sandbox Code Playgroud)

汽车位于它的父母的中心.

当我设定位置时:

car.position = CGPointMake(-50, 0);
Run Code Online (Sandbox Code Playgroud)

然后它位于左侧.但是当我想把它向下移动并增加Y时,它会向上移动!

car.position = CGPointMake(-50, 20);
Run Code Online (Sandbox Code Playgroud)

在UIKit中,增加Y总是意味着向下移动.这对我来说更合乎逻辑.有没有办法在Sprite Kit中翻转坐标系?

sprite-kit skspritenode

7
推荐指数
1
解决办法
3172
查看次数

标签 统计

skspritenode ×1

sprite-kit ×1