Permalink
Browse files

fixed node 0.7 issues with prototype.js

  • Loading branch information...
1 parent 15caea3 commit 7aa4c2f0c6b65cd6a5feba68252e503347eaa192 @zachwe zachwe committed Jul 25, 2011
Showing with 833 additions and 14 deletions.
  1. +1 −8 app.js
  2. +2 −2 public/config.js
  3. +827 −0 public/javascripts/client.js
  4. +3 −4 views/index.ejs
View
9 app.js
@@ -44,7 +44,7 @@ var groups = [];
//on connect: look for a partner. If one is found, create a
//2 player game. otherwise put this.user in the queue
-everyone.on('connect', function() {
+nowjs.on('connect', function() {
if(freeUsers.length != 0) {
var partnerId = freeUsers.shift();
var groupName = partnerId + '_' + this.user.clientId;
@@ -63,7 +63,6 @@ everyone.on('connect', function() {
} else {
nowjs.getClient(this.user.clientId, function() {
- console.log(JSON.stringify(this.now));
this.now.message('Waiting for partner...');
});
freeUsers.push(this.user.clientId);
@@ -111,13 +110,7 @@ everyone.on('disconnect', function() {
});
everyone.now.distributeShot = function(startCoords, dims, delta, angle, groupName) {
- console.log(groupName);
var group = nowjs.getGroup(groupName);
- group.hasClient(this.user.clientId, function(val) {
- console.log(val);
- });
- console.log(9);
group.now.shoot(startCoords, dims, delta, angle);
- console.log(8);
};
View
@@ -36,8 +36,8 @@ var config = {
//size of the slingshot rubber band (used in getBandSize())
bandSize: 170,
//force coefficient for physics
- forceCoeff: 99999999999999999999999999999999999999999999999999999999999999999999,
- gravity: 10,
+ forceCoeff: 30000000,
+ gravity: 300,
//image sources for background tiles
bg1TileSrcs: {
'BLUE_GRASS_FG_1.png': {
Oops, something went wrong.

2 comments on commit 7aa4c2f

What was the issue?

IIRC, prototype.js likes overwriting the Array prototype and implementing toJSON in its own way (which is not at all in accordance with the MDN spec).

As such, it was breaking Socket.IO among other things, since arrays got double-stringified.

Please sign in to comment.