add hand + grab cursor for own player

This commit is contained in:
Zutatensuppe 2020-11-07 17:49:42 +01:00
parent 61837a155f
commit ca387b53ec
6 changed files with 82 additions and 11 deletions

View file

@ -4,8 +4,8 @@ export default class Camera {
constructor(canvas) {
this.x = 0
this.y = 0
// TODO: when canvas resizes, this should
// TODO: when canvas resizes, this should
// syncronize with the cam
this.width = canvas.width
this.height = canvas.height
@ -36,7 +36,7 @@ export default class Camera {
this.y + (this.height + h_final) / 2
)
}
move(x, y) {
this.x += x / this.zoom
this.y += y / this.zoom
@ -74,4 +74,11 @@ export default class Camera {
y: (mouse.y / this.zoom) - this.y,
}
}
}
translateMouseBack(mouse) {
return {
x: (mouse.x + this.x) * this.zoom,
y: (mouse.y + this.y) * this.zoom,
}
}
}