Created
February 7, 2012 11:29
-
-
Save ydnax/1759236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void energy::update(ticks time){ | |
const float angle=getAngle(start, target); | |
float fx, fy, tx, ty; | |
fx=start.x; | |
fy=-1*start.y; | |
tx=target.x; | |
ty=-1*target.y; | |
float dx,dy; | |
const float vert=getPointDistance(start, target); | |
const float addl=pxps*(time/1000); | |
thedistance+=addl; | |
//const float diff=vert-thedistance; | |
if(thedistance>vert){ | |
delete this; | |
return; | |
} | |
dx=sin((angle/180)*M_PI)*thedistance; | |
dy=sqrt(pow(thedistance,2)-pow(dx,2)); | |
xx+=dx; | |
xy+=dy; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment