objective-c - Sprite Kit 中跨设备的缩放点
问题描述
我遇到了一个困扰我很久的问题。我正在为 ios 开发游戏。它几乎完成了,它可以在我自己的 iphone SE 上完美运行。但是,在其他屏幕尺寸上运行它让我很头疼。它不是一个缩放问题,因为背景可以很好地缩放。这个问题实际上是一个点缩放问题。精灵出现在不同设备上的不同位置。我附上了一些照片,所以你可以明白我的意思。外观怪异的在 iphone 8 上,而好看的在 iphone SE 上。我还包含了定义精灵从哪里开始的代码。任何帮助,将不胜感激。,
正如您在上面看到的,由于某种原因,所有东西都被分流了。这是我的问题。
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
解决方案
推荐阅读
- android - 当应用程序不在前台时,为什么 FCM 通知 onClick 不会打开指定的活动?
- angular - 如何开发像附加图像一样的角垫滑块
- jquery - 通过 MySQL 激活链接
- azure - 将文件 (.txt .csv ...) 上传到 Azure blob [使用 PowerShell]
- javascript - 模板文字如何在 javascript 中工作?
- keras - 在 Keras 中,fit_generator() 和evaluate_generator() 中的validation_set 有什么区别
- android - 找不到任何与 com.google.firebase:firebase-messaging:16.0.+ 匹配的版本
- python - TensorFlow 2.0 中分布式数据集的 tf.function input_signature
- c# - C#:预处理器指令中的连字符
- amazon-web-services - 当我从其他管道运行其管道时,Serverspec 测试失败