Guest User

Untitled

a guest
Jan 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public void setLocation(double x, double y) {
  2. _shape.setFrame(x, y, _shape.getWidth(), _shape.getHeight());
  3.  
  4. if (_wrapping == true){
  5. _dpHeight = this.getHeight();
  6. _dpWidth = this.getWidth();
  7.  
  8. double newX = ((x % _dpWidth) + _dpWidth) % _dpWidth;
  9. double newY = ((y % _dpHeight) + _dpHeight) % _dpHeight; //calculates mod
  10. this.setLocation(newX, newY);
  11. _shapeX = newX;
  12. _shapeY = newY;
  13. }
  14. }
Add Comment
Please, Sign In to add comment