Hi, I’m trying out the new 2D system in Unity, which is amazing. I just have a quick question, when I move my character with my move script
using UnityEngine;
using System.Collections;
public class CharacterBehaviour : MonoBehaviour {
public bool jump = false; // Condition for whether the player should jump.
public float moveForce = 365f; // Amount of force added to move the player left and right.
public float maxSpeed = 500f; // The fastest the player can travel in the x axis.
public float jumpForce = 1000f; // Amount of force added when the player jumps.
public Transform target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.D)) {
target.transform.Translate(Vector2.right * maxSpeed * Time.deltaTime, Space.World);
}
if (Input.GetKey(KeyCode.A)) {
target.transform.Translate(-Vector2.right * maxSpeed * Time.deltaTime, Space.World);
}
if(Input.GetButtonDown("Jump")) // && grounded
jump = true;
}
void FixedUpdate () {
if(jump)
{
// Add a vertical force to the player.
rigidbody2D.AddForce(new Vector2(0f, jumpForce));
// Make sure the player can't jump again until the jump conditions from Update are satisfied.
jump = false;
}
}
}
it becomes very “blurry”. Is there a way I can tweak this to make the moving “sharp”? It might be my computer, but it sometimes stutters as well. Thanks!