puzzle/game/Point.js

23 lines
397 B
JavaScript
Raw Normal View History

2020-11-07 11:35:29 +01:00
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
)
}
}