Making a Paddle Move Vertically?

I’m trying to recreate the Pong game as a practice exercise. Right now, i’m trying to get the paddle to move up and down like the following:

This is the code that I have:

using UnityEngine;

using System.Collections;

public class Player : MonoBehaviour {

public int Speed = 10;

void Update () {

Vector3 movement = new Vector3(Input.GetAxis(“Vertical”) * Speed,0,0);

this.transform.Translate(movement * Time.deltaTime);

}

}

But when I press the up/down arrow keys, this code makes the bar move from left to right.

How would I get it to move along the Y-axis and not the x-axis? Does it matter if I’m making a 2D or 3D game?

Thank you

Robertbu,

Thank you for your help.

I changed the line to: Vector3 movement = new Vector3(0,Input.GetAxis(“Vertical”) * Speed,0);

And now instead of moving from left to right it moves inward and outward like its moving on the z axis.

If I’m making it as a basic 2D game should I be using Vector2? or does it matter?