Skip to content

Commit

Permalink
Added a basic client/server network connection and basic events.
Browse files Browse the repository at this point in the history
  • Loading branch information
adngdb committed May 3, 2012
1 parent e241388 commit 537cd83
Show file tree
Hide file tree
Showing 4 changed files with 3,348 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/game/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define(function(require) {
var Entity = require('flux/entity');
var Graphic = require('flux/graphics/graphic');
var Loader = require('flux/resources/loader');
var Network = require('game/network');

var GoutteWorld = require('game/world');

Expand Down
15 changes: 15 additions & 0 deletions js/game/network.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
define(function(require) {
require('lib/socket.io');

var socket = io.connect('http://localhost:8080');
socket.emit('join');
socket.on('awaiting', function(data) {
console.log('Waiting for an opponent');
});
socket.on('gamestarted', function(data) {
console.log('Game started');
});
socket.on('gamewon', function(data) {
console.log('Game WON! \o/');
});
});
Loading

0 comments on commit 537cd83

Please sign in to comment.