diff --git a/app/Game/Client/Collision/Detector.js b/app/Game/Client/Collision/Detector.js index a2a2b0c..dbf3528 100755 --- a/app/Game/Client/Collision/Detector.js +++ b/app/Game/Client/Collision/Detector.js @@ -8,20 +8,10 @@ function(Box2D, Parent) { function Detector(me) { Parent.call(this); this.me = me; - - this.listener = new Box2D.Dynamics.b2ContactListener(); - this.listener.chuckDetector = this; - this.listener.BeginContact = this.BeginContact; - this.listener.PostSolve = this.PostSolve; - this.listener.EndContact = this.EndContact; } Detector.prototype = Object.create(Parent); - Detector.prototype.getListener = function() { - return this.listener; - } - Detector.prototype.handleStand = function(point, isColliding) { if (point.GetFixtureA().GetUserData() == Detector.IDENTIFIER.PLAYER_FOOT_SENSOR || point.GetFixtureB().GetUserData() == Detector.IDENTIFIER.PLAYER_FOOT_SENSOR) { @@ -30,19 +20,5 @@ function(Box2D, Parent) { } } - /** Extension **/ - - Detector.prototype.BeginContact = function(point) { - this.chuckDetector.handleStand(point, true); - } - - Detector.prototype.PostSolve = function(point, impulse) { - this.chuckDetector.handleStand(point, true); - } - - Detector.prototype.EndContact = function(point) { - this.chuckDetector.handleStand(point, false); - } - return Detector; }); \ No newline at end of file diff --git a/app/Game/Core/Collision/Detector.js b/app/Game/Core/Collision/Detector.js index b4e7edc..71cd746 100644 --- a/app/Game/Core/Collision/Detector.js +++ b/app/Game/Core/Collision/Detector.js @@ -1,6 +1,16 @@ -define(function() { +define([ + "Lib/Vendor/Box2D", + "Game/Core/Collision/Detector" +], + +function(Box2D, Parent) { function Detector() { + this.listener = new Box2D.Dynamics.b2ContactListener(); + this.listener.chuckDetector = this; + this.listener.BeginContact = this.BeginContact; + this.listener.PostSolve = this.PostSolve; + this.listener.EndContact = this.EndContact; } Detector.IDENTIFIER = { @@ -12,6 +22,27 @@ define(function() { PLAYER_FOOT_SENSOR: 'footsensor' } - return Detector; + Detector.prototype.getListener = function() { + return this.listener; + } + Detector.prototype.handleStand = function(point, isColliding) { + throw "Overwrite this function"; + } + + /** Extension **/ + + Detector.prototype.BeginContact = function(point) { + this.chuckDetector.handleStand(point, true); + } + + Detector.prototype.PostSolve = function(point, impulse) { + this.chuckDetector.handleStand(point, true); + } + + Detector.prototype.EndContact = function(point) { + this.chuckDetector.handleStand(point, false); + } + + return Detector; }); \ No newline at end of file diff --git a/app/Game/Core/Player.js b/app/Game/Core/Player.js index 4d54cf3..5491d4c 100644 --- a/app/Game/Core/Player.js +++ b/app/Game/Core/Player.js @@ -1,4 +1,9 @@ -define(["Chuck/Physics/Doll", "Chuck/Settings"], function(Doll, Settings){ +define([ + "Game/Core/Physics/Doll", + "Game/Config/Settings" +], + +function(Doll, Settings) { function Player (physicsEngine, id, repository) { this.physicsEngine = physicsEngine; diff --git a/app/Game/Server/Collision/Detector.js b/app/Game/Server/Collision/Detector.js index e69de29..46b63ba 100644 --- a/app/Game/Server/Collision/Detector.js +++ b/app/Game/Server/Collision/Detector.js @@ -0,0 +1,19 @@ +define([ + "Lib/Vendor/Box2D", + "Game/Core/Collision/Detector" +], + +function(Box2D, Parent) { + + function Detector() { + Parent.call(this); + } + + Detector.prototype = Object.create(Parent); + + Detector.prototype.handleStand = function(point, isColliding) { + throw "Implement this function"; + } + + return Detector; +}); \ No newline at end of file