Hi Guys, trying to recreate dark souls whilst also taking notes(its the playlist from Sebastian Graves), and i have just completed movement for my player but when i play i can only move left and right not forward or backwards, any help would be greatly appreciated thanks!
My Vertical counter on my script does change it just doesn’t seem to actually do anything when im testing.
i am a complete beginner and i know its probably an easy fix but i cant seem to figure it out and my code looks the same to Sebastians.
namespace NZ
{
public class InputHandler : MonoBehaviour
{
public float horizontal;
public float vertical;
public float moverAmount;
public float mouseX;
public float mouseY;
PlayerControls inputActions;
Vector2 movementInput;
Vector2 cameraInput;
public void OnEnable()
{
if (inputActions == null)
{
inputActions = new PlayerControls();
inputActions.PlayerMovement.Movement.performed += inputActions => movementInput = inputActions.ReadValue<Vector2>();
inputActions.PlayerMovement.Camera.performed += i => cameraInput = i.ReadValue<Vector2>();
}
inputActions.Enable();
}
private void OnDisable()
{
inputActions.Disable();
}
public void TickInput(float delta)
{
MoveInput(delta);
}
private void MoveInput(float delta)
{
horizontal = movementInput.x;
vertical = movementInput.y;
moverAmount = Mathf.Clamp01(Mathf.Abs(horizontal) + Mathf.Abs(vertical));
mouseX = cameraInput.x;
mouseY = cameraInput.y;
}
}
}