Making a game with node.js and socket.io
Client-side
var statData = {
x: this.pos.x,
y: this.pos.y,
r: this.r,
maxHp: this.maxHp,
hp: this.hp
}
socket.emit('start', statData);
Server-side
io.sockets.on('connection',
function(socket) {
console.log("We have a new client: " + socket.id);
players.push(new Player(socket.id,0,0,64));
socket.on('start',
function(data) {
console.log("HELLO?!?!?");
console.log(socket.id, data.x, data.y, data.r);
var player = new Player(socket.id, data.x, data.y, data.r);
players.push(player);
}
);
);
This doesn't work at all, nothing is sent. Any help?
via Canatron
No comments:
Post a Comment