BBGamelib.CCJumpBy.update C# (CSharp) Method

update() public method

public update ( float t ) : void
t float
return void
		public override void update (float t)
		{
			// Sin jump. Less realistic
			//	ccTime y = _height * fabsf( sinf(t * (CGFloat)M_PI * _jumps ) );
			//	y += _delta.y * dt;
			
			//	// parabolic jump (since v0.8.2)
			float frac =  t * _jumps % 1.0f;
			float y = _height * 4 * frac * (1 - frac);
			y += _delta.y * t;
			
			float x = _delta.x * t;
			
			CCNode node = (CCNode)_target;
			bool stackable = ccConfig.CC_ENABLE_STACKABLE_ACTIONS;
			if(stackable){
				Vector2 currentPos = node.position;
				
				Vector2 diff = currentPos - _previousPos;
				_startPosition = diff +_startPosition;
				
				Vector2 newPos = _startPosition + new Vector2(x,y);
				node.position = newPos;
				
				_previousPos = newPos;
			}else{
				node.position = _startPosition + new Vector2(x, y);
			}
		}