From 6e53ebee3b946acbacb584fd41022232ede1082d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 24 Jan 2013 17:49:47 -0500 Subject: looking into dupe cursor bug --- public/javascripts/game.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'public/javascripts/game.js') diff --git a/public/javascripts/game.js b/public/javascripts/game.js index 1fb5c90..6211758 100644 --- a/public/javascripts/game.js +++ b/public/javascripts/game.js @@ -14,7 +14,7 @@ var game = { socket.emit('joined', JSON.stringify({ "id": window._id })); var now = Date.now(); own_cursor = new Cursor({ - firstname: "you", + firstname: "...", score: 0, current: 0, active: true, @@ -115,16 +115,16 @@ var UI = { } for (var i in data.users) { var user = data.users[i]; - if (!( i in users )) { - users[i] = user; + if (!( user.id in users )) { + users[user.id] = user; } - if (i != _id && ! user.cursor) { + if (user.id != _id && ! user.cursor) { var cursor = new Cursor( user, now ); user.cursor = cursor; user.cursor.el.css({ 'margin-right': -user.x, 'margin-bottom': -user.y }); } - else if (i == _id) { - own_cursor.name.html( users[i].firstname ); + else if (user.id == _id && own_cursor) { + own_cursor.name.html( user.firstname ); } } }, -- cgit v1.2.3-70-g09d2