So im trying to find the slope between 2 points for a game im making in my class at school but im having trouble with the slope for my main characters firing direction. The code might look a little funky but its only because we are using some shitty IDE, i assure you it runs, my problem is the logic. Also the direction functions are both just X and Y coords as are the mouse X and Y functions.
Im currently using
Edit- Also its not simply aiming in the wrong direction its just locked on shooting straight up, occasionally shoots right.
Im currently using
Code:
double slope = (pMouse->Y() - This->DirectionY()) / (pMouse->X() - This->DirectionX());
double slopeY;
double slopeX = modf(slope,&slopeY);