mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
implemented level restart
This commit is contained in:
parent
81611050d2
commit
3edd664412
12 changed files with 104 additions and 47 deletions
|
|
@ -16,16 +16,10 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat
|
|||
|
||||
function GameController () {
|
||||
this.view = ViewManager.createView();
|
||||
|
||||
Parent.call(this, new PhysicsEngine());
|
||||
|
||||
this.physicsEngine.setCollisionDetector();
|
||||
|
||||
this.initStats();
|
||||
this.me = null;
|
||||
|
||||
this.initStats();
|
||||
|
||||
this.update();
|
||||
Parent.call(this);
|
||||
}
|
||||
|
||||
GameController.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -34,6 +28,9 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat
|
|||
this.stats = new Stats();
|
||||
this.stats.setMode(0);
|
||||
document.body.appendChild(this.stats.domElement);
|
||||
var button = document.createElement("button");
|
||||
button.onclick = inspector.resetLevel;
|
||||
document.body.appendChild(button);
|
||||
};
|
||||
|
||||
GameController.prototype.destruct = function() {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
define([
|
||||
"Game/Core/GameObjects/GameObject",
|
||||
"Lib/Utilities/Exception"
|
||||
"Lib/Utilities/Exception",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, Exception) {
|
||||
function (Parent, Exception, NotificationCenter) {
|
||||
|
||||
function GameObject(physicsEngine, uid) {
|
||||
Parent.call(this, physicsEngine, uid);
|
||||
|
|
@ -14,7 +15,6 @@ function (Parent, Exception) {
|
|||
GameObject.prototype = Object.create(Parent.prototype);
|
||||
|
||||
GameObject.prototype.destroy = function() {
|
||||
// view ...
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ function (Parent, Settings, NotificationCenter) {
|
|||
);
|
||||
};
|
||||
|
||||
Item.prototype.destroy = function() {
|
||||
NotificationCenter.trigger("view/removeMesh", this.mesh);
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
Item.prototype.render = function() {
|
||||
|
||||
NotificationCenter.trigger("view/updateMesh",
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ function (Parent, Settings, NotificationCenter) {
|
|||
);
|
||||
};
|
||||
|
||||
Tile.prototype.destroy = function() {
|
||||
NotificationCenter.trigger("view/removeMesh", this.mesh);
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
Tile.prototype.render = function() {
|
||||
|
||||
NotificationCenter.trigger("view/updateMesh",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue