source: java-rpg-common/Point.java

Last change on this file was 04e7260, checked in by dportnoy <dmp1488@…>, 17 years ago

[svn r20]

  • Property mode set to 100644
File size: 534 bytes
RevLine 
[04e7260]1
2public class Point {
3 private int x;
4 private int y;
5
6 public Point() {
7 x = 0;
8 y = 0;
9 }
10
11 public Point(int x, int y) {
12 this.x = x;
13 this.y = y;
14 }
15
16 public int getX() {
17 return x;
18 }
19
20 public int getY() {
21 return y;
22 }
23
24 public void setX(int x) {
25 this.x = x;
26 }
27
28 public void setY(int y) {
29 this.y = y;
30 }
31
32 public String toString() {
33 return x+","+y;
34 }
35
36 public static double dist(Point p1, Point p2) {
37 return Math.sqrt(Math.pow(p1.x-p2.x, 2)+Math.pow(p1.y-p2.y, 2));
38 }
39}
Note: See TracBrowser for help on using the repository browser.