Quantcast
Channel: D3Scene
Viewing all articles
Browse latest Browse all 21080

Need help with some math/code

$
0
0
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
Code:

double slope = (pMouse->Y() - This->DirectionY()) / (pMouse->X() - This->DirectionX());


double slopeY;
double slopeX = modf(slope,&slopeY);

Edit- Also its not simply aiming in the wrong direction its just locked on shooting straight up, occasionally shoots right.

Viewing all articles
Browse latest Browse all 21080

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>