1.
if(Input.GetAxis("Horizontal")>0){
rigidbody.velocity=new Vector2(MoveSpeed,rigidbody.velocity.y);
}
2.没有惯性了还带翻转
if(Input.GetAxisRaw("Horizontal")>0){
rigidbody.velocity=new Vector2(MoveSpeed,rigidbody.velocity.y);
transform.localScale=new Vector2(1f,1f);
}
else if (Input.GetAxisRaw("Horizontal")<0){
rigidbody.velocity=new Vector2(-MoveSpeed,rigidbody.velocity.y);
transform.localScale=new Vector2(-1f,1f);
}
else {
rigidbody.velocity=new Vector2(0,rigidbody.velocity.y);
}
3.双脚着地法?
isground=Physics2D.OverlapCircle(CheckPoint.position,CheckRadius,WhatIsGround);
4.跟随镜头
void Update () {
transform.position=new Vector3(Player.transform.position.x,transform.position.y,transform.position.z);
if(Player.transform.lossyScale.x>0f){
transform.position=new Vector3(Player.transform.position.x+Ahead,transform.position.y,transform.position.z);
}else {
transform.position=new Vector3(Player.transform.position.x-Ahead,transform.position.y,transform.position.z);
}
}
5.这个方法居然也可以哦
ThePlayer=FindObjectOfType<PlayerControl>();