mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
This commit is contained in:
parent
039213cf50
commit
55256ada95
23 changed files with 409 additions and 110 deletions
|
|
@ -3,10 +3,11 @@ define([
|
|||
"Lib/Vendor/Box2D",
|
||||
"Game/Config/Settings",
|
||||
"Game/" + GLOBALS.context + "/Collision/Detector",
|
||||
"Game/" + GLOBALS.context + "/GameObjects/Item"
|
||||
"Game/" + GLOBALS.context + "/GameObjects/Item",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, Box2D, Settings, CollisionDetector, Item) {
|
||||
function (Parent, Box2D, Settings, CollisionDetector, Item, Nc) {
|
||||
|
||||
function Doll (physicsEngine, uid, player) {
|
||||
|
||||
|
|
@ -36,6 +37,8 @@ function (Parent, Box2D, Settings, CollisionDetector, Item) {
|
|||
|
||||
this.createFixtures();
|
||||
this.body.SetActive(false);
|
||||
|
||||
Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this);
|
||||
}
|
||||
|
||||
Doll.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -368,5 +371,9 @@ function (Parent, Box2D, Settings, CollisionDetector, Item) {
|
|||
}
|
||||
};
|
||||
|
||||
Doll.prototype.destroy = function() {
|
||||
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
|
||||
};
|
||||
|
||||
return Doll;
|
||||
});
|
||||
|
|
@ -3,10 +3,11 @@ define([
|
|||
"Lib/Vendor/Box2D",
|
||||
"Lib/Utilities/Options",
|
||||
"Game/Config/Settings",
|
||||
"Lib/Utilities/Exception"
|
||||
"Lib/Utilities/Exception",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, Box2D, Options, Settings, Exception) {
|
||||
function (Parent, Box2D, Options, Settings, Exception, Nc) {
|
||||
|
||||
function Item(physicsEngine, uid, options) {
|
||||
|
||||
|
|
@ -33,6 +34,8 @@ function (Parent, Box2D, Options, Settings, Exception) {
|
|||
this.createFixture();
|
||||
this.body.ResetMassData();
|
||||
this.flipDirection = 1;
|
||||
|
||||
Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this);
|
||||
}
|
||||
|
||||
Item.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -136,6 +139,11 @@ function (Parent, Box2D, Options, Settings, Exception) {
|
|||
|
||||
body.SetAngularVelocity(Settings.MAX_THROW_ANGULAR_VELOCITY * x);
|
||||
};
|
||||
|
||||
Item.prototype.destroy = function() {
|
||||
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
return Item;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,18 @@ define([
|
|||
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
|
||||
"Lib/Vendor/Box2D",
|
||||
"Game/Config/Settings",
|
||||
"Lib/Utilities/Exception"
|
||||
"Lib/Utilities/Exception",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, Box2D, Settings, Exception) {
|
||||
function (Parent, Box2D, Settings, Exception, Nc) {
|
||||
|
||||
function Tile(physicsEngine, uid, options) {
|
||||
this.options = options;
|
||||
Parent.call(this, physicsEngine, uid);
|
||||
this.createPhysicTile(this.options);
|
||||
|
||||
Nc.trigger(Nc.ns.core.game.gameObject.add, 'fixed', this);
|
||||
}
|
||||
|
||||
Tile.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -112,6 +115,10 @@ function (Parent, Box2D, Settings, Exception) {
|
|||
Tile.prototype.addVec = function (vs, m1, m2) {
|
||||
return vs.push(new Box2D.Common.Math.b2Vec2(this.mkArg(m1), this.mkArg(m2)));
|
||||
}
|
||||
|
||||
Tile.prototype.destroy = function() {
|
||||
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'fixed', this);
|
||||
};
|
||||
|
||||
return Tile;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue