What is the code of the movement of the sprite?

Please help. I’m trying to make the sprite move using the right, left, up, and down arrow keys, but I can’t move it up and down. I already had the code of moving the sprite left and right, and I try to edit the code by changing its x-axis to y-axis, but it didn’t work. I don’t know what is still missing in the code. Here’s the code…[37628-boycontroller.txt|37628]

This is what happens when I run it…

I can not test the code because I don’t know from where I could get character controller 2D but there’s what I can suggest:
create a new variable just below normalizedSpeed (line 15) called normalizedSpeedY by doing this:

private float normalizedSpeedY = 0;

And then in lines 84 and 92 where normalizedSpeed variable is being changed change that variable name to newly created one - normalizedSpeedY.
Now in line 105, just after _velocity.x changes add this very similar to that _velocity.x line:

_velocity.y = Mathf.Lerp(
_velocity.y, normalizedSpeedY * swimSpeed, Time.deltaTime *
smoothedMovementFactor );
That’s it! I hope the code works :slight_smile: