agar.io-clone icon indicating copy to clipboard operation
agar.io-clone copied to clipboard

Zoom proportionally to player's mass

Open arnoldcoder opened this issue 9 years ago • 1 comments

Hi fellows! I checked the code and I just saw that no zoom out is executed when the players mass is increasing, like on original agar.io. Could somebody give and advise or discuss or even do it? I don't know what would be the best way to implement this because it's a 2D canvas.... Any idea would be appreciated :)

arnoldcoder avatar Dec 18 '15 09:12 arnoldcoder

very late reply but it might help someone anytime :

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 (t get all the data from the server : socket.emit('windowResized', { screenWidth: global.screenWidth* coef_zoom, screenHeight: global.screenHeight* coef_zoom });

geopi avatar Mar 20 '17 01:03 geopi