Permalink
Browse files

Fixed issues with sprite control

  • Loading branch information...
1 parent 4edbb6f commit e258031803539188754cd7e4c5873dfee87ba830 @robrighter committed Jan 4, 2012
Showing with 6,254 additions and 15 deletions.
  1. +11 −8 server.js
  2. +6,240 −0 static/js/jquery-1.4.2.js
  3. +2 −6 static/js/script.js
  4. +1 −1 views/layout.jade
View
@@ -47,10 +47,16 @@ var io = io.listen(server);
io.sockets.on('connection', function(socket){
console.log('Client Connected');
socket.on('move_character', function(data){
- data.character = keylookups[data.requestkey];
- delete data.requestkey;
- socket.broadcast.emit('server_move_character',data);
- socket.emit('server_move_character',data);
+ if(keylookups.hasOwnProperty(data.requestkey)){
+ var movedata = {
+ character: keylookups[data.requestkey],
+ xv: data.xv,
+ yv: data.yv,
+ direction: data.direction
+ }
+ socket.broadcast.emit('server_move_character',movedata);
+ socket.emit('server_move_character',movedata);
+ }
});
socket.on('disconnect', function(){
console.log('Client Disconnected.');
@@ -78,10 +84,7 @@ function createHash(tohash, callback){
}
function notifyClientsAboutNewCharacter(handle){
- //TODO: FIX THIS
- console.log('GOT HERE!!!!!!!!!!!!!!!!!!!!!!!!!!');
- io.sockets.emit('server_add_character', { handel: handle, details: characters[handle] });
- //io.sockets.broadcast.emit('add_character', characters[handle]);
+ io.sockets.emit('server_add_character', { handle: handle, details: characters[handle] });
}
///////////////////////////////////////////
Oops, something went wrong.

0 comments on commit e258031

Please sign in to comment.