New answers tagged


I'm happy you figured it out, and I find it really cool that you managed to do it in your own way. But yours is a specific solution for a specific occurrence of a very general problem. I would like to explain what exactly happened and why it happened. Just in case others stumble upon this answer, sooner or later, with their own specific occurrence of the ...


I got the solution, it's simple. This is my animatin for it: I saw that it make a square out of the lines and then i could get the diagnol in the square. In that way i could get how much i had to scale the mouse x and y to match where it needed to go. The code would look this this: if (mouseX >= 0 && mouseY >= 0) { ...


As you noticed, you should call requestAnimationFrame only once per frame. It means that you need to call it once upon starting your game, and then once at the end of the same function it calls. For instance: requestAnimationFrame(draw); function draw() { if (onCutScene) drawCutScene(); else if (onMainMenu) drawMainMenu(); else if (inGame) ...


I do not fully understand your issue, however, it may be because you are not scaling your Canvas. You may want to try adding a Canvas Scaler component, and play around with the settings. Possibly set it to Scale with Screen Size, and then set the Match value to 0.5f. If this is not helping, possibly try to provide an animated gif of your issue.

Top 50 recent answers are included