kodestan / tank-ops

639 stars 57 forks source link

zoom to pointer #2

Open johnrees opened 2 months ago

johnrees commented 2 months ago

Hey! I enjoyed your video and thought I'd help out with something. Feel free to change this any of this code or close the PR and do your own thing with it.

I noticed that the game was always zooming to the center of the canvas, regardless of mouse position. This change zooms to the mouse position instead, more like google maps etc.

before

https://github.com/user-attachments/assets/b6edf8a8-cf56-40e2-8214-b4285333fae0

after

https://github.com/user-attachments/assets/d7804a08-939a-486d-901d-7a616a494b98