How make a top down Shooter with iphone joystick?

Hi!

I try to make a top down Shooter game, it run in iphone, but i don’t know how to do that with iphone joystick.

I don’t know how to joystick position.x and position.y to angle.

I want to joystick put to left, the player rotate to left. I want to joystick put to right, the player rotate to right.

I want to joystick put to up, the player rotate to up. I want to joystick put to down, the player rotate to down.

And it game is 2D.

Can anyone know how to make it?

I assume you can figure out how to move and stuff. So I will simply suggest how to face the joystick direction.

//we add this just to make sure the character doesn't snap back every frame.
if(joystick.x > 0 || joystick.y > 0) {
    var rotationDirection = new Vector3(joystick.x, 0 , joystick.y);
    rotationDirection = rotationDirection.normalized;

    //Create a rotation facing that point.
    var rotation = Quaternion.LookRotation(rotationDirection);
    transform.rotation = rotation;
}

This is very basic, it doesn’t interpolate the rotation any either so your character will jump directly to that direction, but it should work nicely.