Ejemplo n.º 1
0
	QCharacterController::QCharacterController(PhysicsManager* pmgr, Vector3 startPos) : CharacterController(pmgr,startPos),mGracePeriod(0)
	{
		mTimeStep = 1.0f/100.0f;
		mAccumulation = 0.0f;
		mInterpolation = 0.0f;
		q_1 = Quaternion(Ogre::Quaternion::IDENTITY);
		q_2 = Quaternion(Ogre::Quaternion::IDENTITY);
		setPlayerSpeed(4.f,7.5f,0.5f);
		setPlayerGravitySpeed(0.9f*2.f,1.5f*2.f,2.0f*2.f);
		mPlayerSpeedInterpolation = 0;
		mPlayerGravityInterpolation = 0;

		mCrouching = false;
		mCrouched = false;
		mCrouchLevel = 0.3f;
		mInMidair = true;
		mMidairTime = 0;
		mMidairTimeBase = 0;
		mJumpFactor = 0;
		mInAirLast = true;
		mOffset = 0;
		mIsJumping = false;
		mGroundImpactSpd = 0.0f;
		mGroundImpact = 0.0f;
		mHittingGround = false;
		mImpactLevel = 0.0f;

		mBobSwap = false;
		mBobPeriod = 0.0f;
		mBobLR = false;
		//mJumpDir = NxVec3(0,0,0);
	}
Ejemplo n.º 2
0
void physJump(){
   if(playerJump==1){
      setPlayerSpeed(0,30,0);
      playerJump=0;
      playerFall = 0;
      anim = JUMP;
      musicPlayer.BGM.playSFX("../Assets/Sounds/Jump.wav");
   }
}
Ejemplo n.º 3
0
void TileMap::walkSequenceToGoal(Sprite* sprite, Vec2 touchLocation)
{
	if (_findPath.size() >= 1) {
//		this->setViewPointCenter(_player->getPosition());	//set player in the center of screen //no use
//		_posInScreen = Vec2(_visibleSize.width*1/2, _visibleSize.height*1/2);//set player in the of screen //no use
		auto playerPos = _player->getPosition();
		auto pos = positionFromMapCoord(touchLocation);
		_timeFactor = setPlayerSpeed(playerPos, pos);

		CallFunc* callFunc_1 = CallFunc::create(CC_CALLBACK_0(TileMap::walkSequenceToGoal,this,sprite,touchLocation));
		auto moveTo = MoveTo::create(_timeFactor,pos);
		auto sequence = Sequence::create(moveTo,callFunc_1,NULL);
		sequence->setTag(78);
		sprite->runAction(sequence);
	}
}