Unity仿制经典像素游戏笨鸟先飞
一、场景搭建
- 新建一个场景,并导入素材

- 导入天空,并调整图层顺序

- 导入水管素材

二、像素鸟的搭建
- 添加小鸟对象

- 为小鸟添加2D刚体,并修改其重力为0.7

- 新建脚本
SportCtrl
,并添加以下代码
Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
Fly();
}
public void Fly()
{
float xSpeed = 1f;
Vector3 v = rb.vel