I have a multiplayer game that assigns and displays an avatar for each player that accesses the game.
When a player leaves the game, it will drop the image so the avatar is no longer on screen. This works - sort of.
Here is the problem: Ex: Three players access the game, three avatars are created. Then one player leaves, that avatar is removed from screen. The other two players leave, and for some reason, the last avatar remains on screen. So the host will always see that last avatar sitting there.
I'm using splice to remove the players. I check my array and all players dropped from the array. It shows []. I have no clue how that avatar is still there.
Is there a way to completely remove that socket.id from the game?