Skip to content

Instantly share code, notes, and snippets.

@onedayitwillmake
Created May 10, 2011 01:49
Show Gist options
  • Save onedayitwillmake/963783 to your computer and use it in GitHub Desktop.
Save onedayitwillmake/963783 to your computer and use it in GitHub Desktop.
ClosureIssue
/**
File:
PerlinNoiseTrait.js
Created By:
Mario Gonzalez
Project :
RealtimeMultiplayerNodeJS
Abstract:
Applies perlin noise to an objects velocity
Basic Usage:
*/
(function(){
BubbleDots.namespace("BubbleDots.traits");
BubbleDots.traits.PerlinNoiseTrait = function() {
BubbleDots.traits.PerlinNoiseTrait.superclass.constructor.call(this);
};
BubbleDots.traits.PerlinNoiseTrait.prototype = {
displayName : "PerlinNoiseTraitTrait", // Unique string name for this Trait
/**
* @inheritDoc
*/
attach: function(anEntity) {
BubbleDots.traits.PerlinNoiseTrait.superclass.attach.call(this, anEntity);
this.intercept(['handleAcceleration']);
},
/**
* Intercepted properties
*/
handleAcceleration: (function(){
console.log(this.displayName);
return function() {
// console.log(ABC123);
}
})()
};
// Extend BaseTrait
RealtimeMultiplayerGame.extend( BubbleDots.traits.PerlinNoiseTrait, RealtimeMultiplayerGame.controller.traits.BaseTrait );
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment