Direct X - Problem with steering in flight game

So, I am working on a game where you steer an airplane. I have a slight problem with the steering. It works if you only want to steer left and right and accelerate or if you only want to steer up and down. But it dosnt work together.

The code:

if(keystate[DIK_LEFT] & 0x80) airplane_x_angle+=0.2f;
if(keystate[DIK_RIGHT] & 0x80) airplane_x_angle-=0.2f;
if(keystate[DIK_UP] & 0x80){ airplane_y_angle-=0.03f; }
if(keystate[DIK_DOWN] & 0x80){ airplane_y_angle+=0.03f; }
if(keystate[DIK_SPACE] & 0x80){
airplane_x-=0.5f*sin(airplane_x_angle);airplane_z+=0.5f*(cos(airplane_x_angle));
airplane_y+=0.5f*sin(airplane_y_angle);airplane_z+=0.5f*(cos(airplane_y_angle));
}

As I said the steering works perfectly besides the problem with the variable airplane_z. I have to combine the 2 lines airplane_z+=0.5f*(cos(airplane_x_angle)); and airplane_z+=0.5f*(cos(airplane_y_angle)); . But I dont know how. If I remove for example airplane_z+=0.5f*(cos(airplane_x_angle)); the vertical steering works perfectly. If I remove the other line the horisontal steering works perfectly. If I do both airplane_z would react wrong.

Btw: I know the variables have very confusing names.
Hey,

im not too sure about it, ive had similar problems in BASIC, i posted in the forums on:
www.gamedev.com
Its a site dedicated to gamedev-ing!
I suggest you post there, you'll might have more luck!
-H
Topic archived. No new replies allowed.