Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void gravity(AnimatedSprite T, double massA, double massB)
- {
- //
- //distance getter
- double dist = this.DisToOther(T);
- double force = 9.8 * Math.pow( ( (massA * massB) / dist ),2 );
- if( Math.abs(this.center().X()) > Math.abs(T.center().X()) )
- {
- T.setXVelocity( (T.velocity().X()-force) );//T.velocity().X()
- }
- if( Math.abs(this.center().Y()) > Math.abs(T.center().Y()) )
- {
- T.setYVelocity( (T.velocity().Y()-force) );//T.velocity().Y()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement