Moving Up, Down, Left and Right via Wasd and the arrow btns?? in 2d

I just want to move the object via wasd or arrow btns like in space invader! 2D! How to do it? Javascript pls! if script examples are getting used!!

should work sumhow like that??

if (Input.GetButtonDown ("Jump")) {
rigidbody.velocity = Vector3(0,10,0);

only for my wasd!


If you want to move the object using applied forces, it might look something like this (untested):

function FixedUpdate()
        Input.GetAxis("Horizontal") * forceMagnitude,
        Input.GetAxis("Vertical") * forceMagnitude,

I made a cube fly around like a spaceship with this script:

function FixedUpdate()
{rigidbody.velocity = Vector3(
        Input.GetAxis("Horizontal") * speed,
        Input.GetAxis("Vertical") * speed,

This makes the spaceship fly around on the xy plane. You may need to change the speed depending on the mass of the spaceship. Also, make sure the the Horizontal and Vertical axes are set to wasd keys and the rigidbody is not affected by gravity.

I hope this helps.