HTML and CSS Reference
In-Depth Information
chatMessages.push(event.userName + ":" + esob.getString("message"));
} else if (esob.getString("type") == "newball") {
statusMessages.push("create ball")
createNetBall(esob.getFloat("tempX"),esob.getFloat("tempY"),
esob.getFloat("tempSpeed"),esob.getFloat("tempAngle"),
esob.getFloat("tempRadius"),esob.getFloat("velocityx"),
esob.getFloat("velocityy"),event.userName,esob.getString("usercolor"),
esob.getString("ballname") );
}
}
function update() {
for (var i =0; i <balls.length; i++) {
ball = balls[i];
//Friction
ball.velocityx = ball.velocityx - ( ball.velocityx*friction);
ball.velocityy = ball.velocityy - ( ball.velocityy*friction);
ball.nextx = (ball.x += ball.velocityx);
ball.nexty = (ball.y += ball.velocityy);
}
}
function testWalls() {
var ball;
var testBall;
for (var i = 0; i <balls.length; i++) {
ball = balls[i];
if (ball.nextx+ball.radius > theCanvas.width) {
ball.velocityx = ball.velocityx*-1;
ball.nextx = theCanvas.width - ball.radius;
} else if (ball.nextx-ball.radius < 0 ) {
ball.velocityx = ball.velocityx*-1;
ball.nextx = ball.radius;
} else if (ball.nexty+ball.radius > theCanvas.height ) {
ball.velocityy = ball.velocityy*-1;
ball.nexty = theCanvas.height - ball.radius;
} else if(ball.nexty-ball.radius < 0) {
ball.velocityy = ball.velocityy*−1;
ball.nexty = ball.radius;
}
}
}
Search WWH ::




Custom Search