首页 > 解决方案 > Sprite Kit 中跨设备的缩放点

问题描述

我遇到了一个困扰我很久的问题。我正在为 ios 开发游戏。它几乎完成了,它可以在我自己的 iphone SE 上完美运行。但是,在其他屏幕尺寸上运行它让我很头疼。它不是一个缩放问题,因为背景可以很好地缩放。这个问题实际上是一个点缩放问题。精灵出现在不同设备上的不同位置。我附上了一些照片,所以你可以明白我的意思。外观怪异的在 iphone 8 上,而好看的在 iphone SE 上。我还包含了定义精灵从哪里开始的代码。任何帮助,将不胜感激。苹果手机,苹果手机 8

正如您在上面看到的,由于某种原因,所有东西都被分流了。这是我的问题。

   float branch1StartingPos = 284; //where the first branch starts so that it goes the length of the screen.
float branch2StartingPos = 856; //where the second branch starts so that it is completely off the screen and moves on until it gets to branch1startingpos in which case branch 1 completely on the screen.
float branchOffScreen = -284; //the position at which the branch is now completely off screen
float lifeForceStartingPos = 180.0; //where the green life force starts

标签: objective-csprite-kit

解决方案


推荐阅读