# Shooting in 8 directions

**URL:** <https://forum.kirupa.com/t/shooting-in-8-directions/150791>\
**Category:** programming\
**Created:** [June 10, 2005, 11:06am UTC](https://forum.kirupa.com/t/shooting-in-8-directions/150791 "2005-06-10T11:06:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![geebee](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@geebee](https://forum.kirupa.com/u/geebee)\
**Post date:** [June 10, 2005, 11:06am UTC](https://forum.kirupa.com/t/shooting-in-8-directions/150791/1 "2005-06-10T11:06:46Z")

</div>

Greetings…

New problem for you guys to chew on:

In my little shooter game I control the player movement with the arrow keys, space for shooting and wasd for aiming up,down,left and right.

If the player presses the w (aim north) AND the d (aim east) keys at the same time I want the player to aim northeast.

How do I achieve that?

Right now my aiming code looks like this:

//aiming  
if (Key.isDown(87)) {  
this.\_rotation = 0;  
fire();  
}  
if (Key.isDown(83)) {  
this.\_rotation = 180;  
fire();  
}  
if (Key.isDown(68)) {  
this.\_rotation = 90;  
fire();  
}  
if (Key.isDown(65)) {  
this.\_rotation = 270;  
fire();  
}  
// aiming end
