owenashurst / agar.io-clone

Agar.io clone written with Socket.IO and HTML5 canvas
MIT License
2.88k stars 1.12k forks source link

Remove virus after split [Idea] #464

Closed Awersione closed 7 years ago

Awersione commented 7 years ago

When splite by the virus of the current version, the virus can not be deleted.

example code:

server.js

find: function deleteFood(f) add below function

function deleteVirus(f){ virus[f] = {}; virus.splice(f, 1); }

find : if(virusCollision > 0 && currentCell.mass > virus[virusCollision].mass) { sockets[currentPlayer.id].emit('virusSplit', z); }

replace with : if(virusCollision > 0 && currentCell.mass > virus[virusCollision].mass) { sockets[currentPlayer.id].emit('virusSplit', z); virusCollision.forEach(deleteVirus); }

vikramdurai commented 7 years ago

I created a pull for fixing this (https://github.com/huytd/agar.io-clone/pull/493)