Here is my code.
PlayerControls controls;
Vector2 move;
void Awake()
{
controls = new PlayerControls();
controls.Gameplay.Move.performed += ctx => move = ctx.ReadValue<Vector2>();
controls.Gameplay.Move.canceled += ctx => move = Vector2.zero;
}
void Update()
{
Vector2 m = new Vector2(move.x, move.y = 0.8f) * Time.deltaTime;
transform.Translate(m, Space.World);
}
void OnEnable()
{
controls.Gameplay.Enable();
}
void OnDisable()
{
controls.Gameplay.Disable();
}
I have also attached a video.
@jmhoubre Thank you so much! I did have to change the title of the game to Hoppy Cube from Blocky because the cube kept hopping but I like it more this way.
– runningmutton