Hello I'm trying to pass a key array to a function in another class and its not working. Can anyone explain to me essentially what the key array is? Is it an array of char? Well anyways here is my code I'm getting errors please help. Thanks
HERE IS MY CALL IN THE MAIN FUNCTION
bullet.gunDirection(leftOrRight, key[], screen, position);
HERE IS MY FUNCTION WITHIN THE CLASS
void Projectile::gunDirection(char previousDirection, char currentDirection, BITMAP* screen, Motion position){
//Points to be used for drawing the player
int X2 = position.getXLocal() + 15;
int Y2 = position.getYLocal() - 15;
int X3 = position.getXLocal() + 30;
int Y3 = position.getYLocal() - 30;
int Y4 = position.getYLocal() - 35;
//If the user pressed the left arrow key then
//the player will point the gun to the left
if(currentDirection[KEY_LEFT]){
line(screen,X2,Y3,position.getXLocal(),Y3,makecol(255, 0, 0));
previousDirection = KEY_LEFT;
}
//If the user pressed the right arrow key then
//the player will point the gun to the right
else if(currentDirection[KEY_RIGHT]){
line(screen,X2,Y3,X3,Y3,makecol(255, 0, 0));
previousDirection = KEY_RIGHT;
}
//If the user didn't press anything and the previous
//arrow selected was left then we keep pointing the
//gun to the left
else if(previousDirection == KEY_LEFT)
line(screen,X2,Y3,position.getXLocal(),Y3,makecol(255, 0, 0));
//Otherwise we point the gun to the right
else
line(screen,X2,Y3,X3,Y3,makecol(255, 0, 0));
}