Help With Editing a Movement System?

so currently I am working on Unity iPhone and have recently done the penelope tutorial

upon finishing the tutorial I wanted to start working on a top down space shooter much like EV Nova, Now the only problem is that I want to slightly adjust a movement script I had written.

You see my movement script will turn and face the player in the direction that the JoyStick is point and start moving the player in that direction.

I need my script to only turn the player when the joystick is moved left or right and to only move the player forward when the joystick is moved forward and to stop the player when the joystick is moved backwards.

Another nice effect could be if the person playing the game move the joystick forward the player will move forward but not stop moving forward until the joystick is pulled backwards kinda to simulate how something would fly in space.

I’m very new to Unity Coding

Thanks

here is the original script
Any suggestions are appreciated

@script RequireComponent( CharacterController ) 

var moveJoystick : Joystick; 
var cameraTransform : Transform; 
var speed : float = 6;
private var thisTransform : Transform; 
private var character : CharacterController;

function Start(){ 
	thisTransform = GetComponent( Transform ); 
	character = GetComponent( CharacterController );
}

function FaceMovementDirection(){
	var horizontalVelocity : Vector3 = character.velocity;
	horizontalVelocity.y = 0;
	if ( horizontalVelocity.magnitude > 0.1)
	thisTransform.forward = horizontalVelocity.normalized;
}

function Update(){ 
	var movement = cameraTransform.TransformDirection( Vector3(
					moveJoystick.position.x, 0, moveJoystick.position.y ) );
	movement.y =0;
	movement.Normalize();
	
	var absJoyPos =	Vector2( Mathf.Abs( moveJoystick.position.x ), 
							Mathf.Abs( moveJoystick.position.y ) );
	movement *=	speed * ( ( absJoyPos.x > absJoyPos.y ) ? absJoyPos.x : absJoyPos.y );
	movement *= Time.deltaTime;
	
	
		// Actually move the character
		movement += Physics.gravity;
	character.Move( movement );
	
	
	FaceMovementDirection();
}

I’d say the only issue with this is how to STOP the object. If you pulled back on the joystick, would it not go in the new direction? Depends how you code it, I suppose.

You first need to look at this line:
private var character : CharacterController;

and this line:
character.Move( movement );

This script is currently set up to move a character controller. To do a space shooter, you’d prolly just have a simple GameObject/Transform or add a RigidBody depending on how you want to work it.

Now look at the lines that actually DO something, like:
var absJoyPos = Vector2( Mathf.Abs( moveJoystick.position.x ), Mathf.Abs( moveJoystick.position.y ) );
movement *= speed * ( ( absJoyPos.x > absJoyPos.y ) ? absJoyPos.x : absJoyPos.y );
movement *= Time.deltaTime;

Hook these into doing what you want for your ship. If the joystick goes this way, then you ship does… whatever you’d like.