mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
Fixed tile and scale sizes, Fixed Animation using RequestAnimationFrame
This commit is contained in:
parent
01043a2ea3
commit
ff6456fd47
6 changed files with 137 additions and 116 deletions
|
|
@ -4,10 +4,11 @@ var requires = [
|
|||
"Chuck/Control/InputControlUnit",
|
||||
"Chuck/Settings",
|
||||
"Box2D/Box2D",
|
||||
"Chuck/Loader/Level"
|
||||
"Chuck/Loader/Level",
|
||||
"RequestAnimationFrame"
|
||||
];
|
||||
|
||||
define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box2D, Level){
|
||||
define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box2D, Level, requestAnimFrame){
|
||||
|
||||
function Processor () {
|
||||
this._me;
|
||||
|
|
@ -41,10 +42,11 @@ define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box
|
|||
//this._physicsEngine.setCollisionDetector(this._me);
|
||||
}
|
||||
|
||||
//new Chuck.Loader.Level(this._physicsEngine);
|
||||
//new Chuck.Loader.Level(this._physicsEngine);u
|
||||
//new Items();
|
||||
|
||||
setInterval(this._update, 1000/60, this);
|
||||
//setInterval(this._update, 1000/60, this);
|
||||
this._update();
|
||||
}
|
||||
|
||||
Processor.prototype.loadLevel = function(path) {
|
||||
|
|
@ -101,15 +103,18 @@ define(requires, function(PhysicsEngine, Player, InputControlUnit, Settings, Box
|
|||
return this._me;
|
||||
}
|
||||
|
||||
Processor.prototype._update = function(self) {
|
||||
Processor.prototype._update = function() {
|
||||
|
||||
|
||||
requestAnimFrame(this._update.bind(this));
|
||||
|
||||
//console.log(self._physicsEngine.getWorld().GetBodyList().GetPosition());
|
||||
|
||||
self._physicsEngine.update();
|
||||
this._physicsEngine.update();
|
||||
|
||||
if(Settings.IS_BROWSER_ENVIRONMENT) {
|
||||
self._inputControlUnit.update();
|
||||
self._me.update();
|
||||
this._inputControlUnit.update();
|
||||
this._me.update();
|
||||
//self._camera.update();
|
||||
//self._repository.update();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue