using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour{
public float maxSpeed = 3;
public float speed = 50f;
public float jumpPower = 150f;
public bool grounded;
private Rigidbody2D rb2d;
void Start ()
{
rb2d = gameObject.GetComponent();
}
void Update ()
{
}
void FixedUpdate()
{
float h = Input.GetAxis("Horizontal");
rb2d.AddForce((Vector2.right * speed) * h);
if (rb2d.velocity.x > maxSpeed)
{
}
}
}
↧