mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Splitted Client and Server Processors
This commit is contained in:
parent
ae53d40c60
commit
8f38c6dcc6
4 changed files with 74 additions and 35 deletions
46
lib/Chuck/Processors/ServerProcessor.js
Executable file
46
lib/Chuck/Processors/ServerProcessor.js
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
var requires = [
|
||||
"Chuck/Physics/Engine",
|
||||
"Chuck/Player",
|
||||
"Vendor/Box2D",
|
||||
"Chuck/Loader/Level",
|
||||
"RequestAnimationFrame"
|
||||
];
|
||||
|
||||
define(requires, function(PhysicsEngine, Player, Box2D, Level, requestAnimFrame){
|
||||
|
||||
function ServerGame () {
|
||||
this.init();
|
||||
};
|
||||
|
||||
ServerGame.prototype.init = function() {
|
||||
this.physicsEngine = new PhysicsEngine();
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
ServerGame.prototype.loadLevel = function(path) {
|
||||
if (this.level) {
|
||||
this.level.unload();
|
||||
}
|
||||
|
||||
this.level = new Level(path, this.physicsEngine);
|
||||
this.level.loadLevelInToEngine();
|
||||
|
||||
console.log(this.level);
|
||||
}
|
||||
|
||||
ServerGame.prototype.getPhysicsEngine = function() {
|
||||
return this.physicsEngine;
|
||||
}
|
||||
|
||||
ServerGame.prototype.update = function() {
|
||||
requestAnimFrame(this.update.bind(this));
|
||||
this.physicsEngine.update();
|
||||
}
|
||||
|
||||
ServerGame.prototype.destruct = function() {
|
||||
|
||||
}
|
||||
|
||||
return ServerGame;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue