adding responsive
This commit is contained in:
parent
491195e7d3
commit
bd2195de5f
1 changed files with 4 additions and 2 deletions
|
@ -10,8 +10,10 @@ class Input {
|
|||
return;
|
||||
}
|
||||
|
||||
let mouseX = e.clientX - this.canvas.getBoundingClientRect().left;
|
||||
let mouseY = e.clientY - this.canvas.getBoundingClientRect().top;
|
||||
let bounds = this.canvas.getBoundingClientRect();
|
||||
|
||||
let mouseX = (e.clientX - bounds.x)*this.canvas.width/bounds.width;
|
||||
let mouseY = (e.clientY - bounds.y)*this.canvas.height/bounds.height;
|
||||
|
||||
if(player.x>=2000 && player.y>=2000) {
|
||||
mouseX+=2000;
|
||||
|
|
Loading…
Reference in a new issue