Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (player.body != null) { // Alive, update stuff
- player.fov += 1/20 * (player.body.fov * (1 + 0.002 * player.body.skill.level) - player.fov);
- player.guiData = player.gui.export();
- console.log(player.guiData.upgrades); /*************** logged here ****************/
- } else { // u dead bro
- sockets[player.id].emit('RIP');
- }
- // Find what the user can see
- let visible = entity.map(function(e) {
- if (e.x > player.camera.x - player.fov/2 - 2*e.size &&
- e.x < player.camera.x + player.fov/2 + 2*e.size &&
- e.y > player.camera.y - player.fov/2/(16/9) - 2*e.size &&
- e.y < player.camera.y + player.fov/2/(16/9) + 2*e.size) {
- return e.camera();
- }
- }).filter(function(e) { return e; });
- visible.reverse(); // So it draws right
- // Send it to the player
- sockets[player.id].emit(
- 'uplink',
- { x: player.camera.x, y: player.camera.y, view: player.fov },
- visible,
- player.guiData, /****************** Here it goes in ******************/
- [], //debugLines,
- [], //debugCircles,
- [] //debugRects
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement