Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zooming out and in players feature request #426

Open
slowas opened this issue May 31, 2016 · 4 comments
Open

Zooming out and in players feature request #426

slowas opened this issue May 31, 2016 · 4 comments
Labels

Comments

@slowas
Copy link

slowas commented May 31, 2016

How add zooming in this? HELP

@abalabahaha
Copy link
Collaborator

Could you give more details?

@Nikitaw99
Copy link

@abalabahaha Apperantly, he wants to have a feature to be able to zoom in and zoom out.

@AlexDicy
Copy link

AlexDicy commented Oct 4, 2016

Even proportional to the player
And if you zoom out in your browser, the canvas should not zoom out (see agar.io)

@geopi
Copy link

geopi commented Mar 20, 2017

Here a copy paste of my reply in 2 other similar 'issues' regarding this :

You basically just need to put a graph.setTransform(x, 0, 0, x, 0, 0); inside the app.js file in the gameloop function and just after graph.fillRect(0, 0, global.screenWidth * zoomfactor , global.screenHeight * zoomfactor );

Note the zoom factor variable (actually it should be called dezoom factor).
Then you just apply the zoom factor after global.screenWidth/height and global.gameWidth/height to the position of every entities that is drawn .

also here (to get all the data from the server : socket.emit('windowResized', { screenWidth: global.screenWidth* coef_zoom, screenHeight: global.screenHeight* coef_zoom });

careful though because of the game architecture, sending many visible entities uses a lot of bandwith and you ll need to optimize the amount of data sent (there is a lot of optimization possible) , unless of course you make a predictive client side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants