2D Movement
I am trying to make a code that moves left and right for unity in a 2D project, but there is a weird error occuring. Can someone help?
using UnityEngine;
public class Movement : MonoBehaviour
{
public float moveSpeed = 3f;
public float jumpHeight;
private KeyCode lastHitKey;
void Start()
{
}
void Update()
{
if(Input.GetKeyDown (KeyCode.D))
{
if(lastHitKey ==KeyCode.D)
{
movement.x = (transform.rightTime.deltaTime-moveSpeed).x;
}
}
if(Input.GetKeyDown (KeyCode.A))
{
if(lastHitKey ==KeyCode.A)
{
movement.x = (transform.rightTime.deltaTimemoveSpeed).x;
}
}
}
}
using UnityEngine;
public class Movement : MonoBehaviour
{
public float moveSpeed = 3f;
public float jumpHeight;
private KeyCode lastHitKey;
void Start()
{
}
void Update()
{
if(Input.GetKeyDown (KeyCode.D))
{
if(lastHitKey ==KeyCode.D)
{
movement.x = (transform.rightTime.deltaTime-moveSpeed).x;
}
}
if(Input.GetKeyDown (KeyCode.A))
{
if(lastHitKey ==KeyCode.A)
{
movement.x = (transform.rightTime.deltaTimemoveSpeed).x;
}
}
}
}