Gun control with keys

Iam making a game, i have a gun at the bottom of the screen which rotates , shoots bullets.

  1. The gun has to rotate left if i press left arrow key and right if i press right arrow key.
  2. The rotation of the gun should not go below the ground level on both the left and right.
  3. When i rotate and press space then bullet should travel in that andgle and not straight.

Eg : just like in old paratroopers pc game.
How do i do this.