puzzle/game/Point.js
2020-11-10 18:48:16 +01:00

22 lines
397 B
JavaScript

export default class Point {
constructor(x,y) {
this.x = x
this.y = y
}
move(x, y) {
this.x += x
this.y += y
}
add(other) {
return new Point(
this.x + other.x,
this.y + other.y
)
}
sub(other) {
return new Point(
this.x - other.x,
this.y - other.y
)
}
}