gpt4 book ai didi

swift 2 : Different gravity to different sprites

转载 作者:行者123 更新时间:2023-11-28 06:49:10 26 4
gpt4 key购买 nike

我正在创建一个游戏,我需要能够改变玩家 Sprite 的速度。我认为最好的选择是通过重力影响 Sprite 。为了给用户运动的感觉,我希望背景以完全相同的速度向相反的方向移动。

我怎样才能给背景一个不同于玩家 Sprite 的重力?

如果您知道更好的方法,我也非常感谢您的建议。

最佳答案

您可以更改节点的 linearDamping 属性以更改它下降的速率。从文档中,

This property is used to simulate fluid or air friction forces on the body. The property must be a value between 0.0 and 1.0. The default value is 0.1. If the value is 0.0, no linear damping is applied to the object.

请注意,线性阻尼也会影响节点的左右移动。

关于 swift 2 : Different gravity to different sprites,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35380590/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com