The x works and it makes the player walk horizontal but the y just moves it horizontal too.
Can someone help me?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed;
private float x;
private float y;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
x = Input.GetAxis("Horizontal");
y = Input.GetAxisRaw("Vertical");
transform.position += (Vector3)new Vector2(x * speed * Time.deltaTime, 0);
transform.position += (Vector3)new Vector2(y * speed * Time.deltaTime, 0);
}
}