File: gameplay\movement\wall-grappling\Components.js
/**
A component class that adds the ability to grapple vertical surfaces.
@class WallGrappling
@constructor
@param [slidingSpeed] {Number} This value will be used to set the vertical velocity of a grappling entity. If not provided, it'll default to 0, which means no sliding.
*/
function WallGrappling(slidingSpeed){
this._slidingSpeed = slidingSpeed || 0;
this._grapplingLeftCounter = 0;
this._grapplingRightCounter = 0;
}
WallGrappling.prototype = {
constructor : WallGrappling,
_componentIdentifier : 0,
/**
@method getSlidingSpeed
@return {Number}
*/
getSlidingSpeed : function(){
return this._slidingSpeed;
},
/**
@method setSlidingSpeed
@param slidingSpeed {Number} This value will be used to set the vertical velocity of a grappling entity.
*/
setSlidingSpeed : function(slidingSpeed){
this._slidingSpeed = slidingSpeed;
},
/**
@method isGrapplingLeft
@return {Boolean} Returns true if the entity is grappling a wall on the left side.
*/
isGrapplingLeft : function(){
return this._grapplingLeftCounter > 0;
},
/**
@method isGrapplingRight
@return {Boolean} Returns true if the entity is grappling a wall on the right side.
*/
isGrapplingRight : function(){
return this._grapplingRightCounter > 0;
}
};