# Gun control with keys

**URL:** <https://forum.kirupa.com/t/gun-control-with-keys/194583>\
**Category:** programming\
**Created:** [July 24, 2006, 6:56pm UTC](https://forum.kirupa.com/t/gun-control-with-keys/194583 "2006-07-24T18:56:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![messi](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@messi](https://forum.kirupa.com/u/messi)\
**Post date:** [July 24, 2006, 6:56pm UTC](https://forum.kirupa.com/t/gun-control-with-keys/194583/1 "2006-07-24T18:56:16Z")

</div>

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.
