我正在制作一款2d侧卷轴赛车游戏。玩家是在已经创建的2d地形上移动的汽车。相机跟随播放器。
我还想通过让背景跟随播放器的y轴来创建更多的部门,这样背景看起来不像普通图片。
我想要复制的效果是,当玩家跳过相机时,只需缩放即可。我正在使用透视相机,因此通过稍微远离播放器(更多)移动它来缩小。效果并不顺畅。
平台正在使用2d边缘对撞机。这场运动让我晕车,我只是不知道自己应该做些什么才能让这个很好地跟进。
我尝试使用光滑的潮湿,这给了我弹簧效果,这里不需要。我使用了Lerp,它根本不起作用,它的速度很慢,而且当它加速时它只是同样的不良行为。 void FixedUpdate()
{
if (CarController.Instance != null)
{
newPos = TargetPos + camOffSet;
if (!CarController.Instance.IsGrounded && CarController.Instance.CanZoomOut)
{
float zz = Mathf.Clamp(-10 - newPos.y, -20, -10);
newPos.z = Mathf.Clamp(-10 - newPos.y, -20, -10);
newPos.x += (zz * -0.4f);
}
else
{
newPos.z = -10;
}
transform.position = Vector3.MoveTowards(transform.position, newPos, speed * Time.deltaTime);
}
}
有点但不太正常。光滑度不是我想要的。
from pprint import pprint
import os
from xml2xlsx import xml2xlsx
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
template = open(BASE_DIR + '\\111.xml', 'r', encoding='utf-8').read()
f = open(BASE_DIR + '\\test.xlsx', 'wb')
f.write(xml2xlsx(template))
f.close()
作为参考,我的游戏与TextRenderingHint视频中显示的 I Hate Zombies 非常相似。