added Server and Client Game

This commit is contained in:
Jeena Paradies 2012-07-13 19:33:52 +02:00
parent e959c8e7a2
commit bffb16e77c
5 changed files with 57 additions and 10 deletions

View file

@ -1,8 +1,8 @@
define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
define(["Protocol/Helper", "Chuck/ClientGame"], function(ProtocolHelper, ClientGame) {
function Networker(socketLink) {
this.socketLink = socketLink;
this.game = null;
this.clientGame = null;
this.init();
}
@ -36,8 +36,8 @@ define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
}
Networker.prototype.onDisconnect = function() {
this.game.destruct();
this.game = null;
this.clientGame.destruct();
this.clientGame = null;
}
Networker.prototype.join = function(channelName){
@ -50,7 +50,8 @@ define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
}
Networker.prototype.onJoinSuccess = function(channelName) {
this.game = new Game(this);
this.clientGame = new ClientGame(this);
this.clientGame.loadLevel("default.json")
}
Networker.prototype.processControlCommand = function(command, options){
@ -60,7 +61,7 @@ define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
break;
case 'gameCommand':
this.game.processGameCommand(options);
this.clientGame.processGameCommand(options);
break;
default: