• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Jump函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Jump函数的典型用法代码示例。如果您正苦于以下问题:C++ Jump函数的具体用法?C++ Jump怎么用?C++ Jump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Jump函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NextWalkableCell

const JPSPlusPathFinder::Cell* JPSPlusPathFinder::Jump(const Cell* nextCell, const Cell* goalCell, Direction direction, bool& outIsCompleted, Direction& outMarkedDirection)
{
	/* assert(next_cell != nullptr); */
	const Cell *nextNextCell1, *nextNextCell2, *nextNextCell3;

	if (nextCell == goalCell)
	{
		outIsCompleted = true;
		outMarkedDirection = direction;
		return nextCell;
	}

	if (!IsDirectionDiagonal(direction))
	{
		if (((!NextWalkableCell(nextCell, (direction)+3) && NextWalkableCell(nextCell, (direction)+2)) || (!NextWalkableCell(nextCell, (direction)+5) && NextWalkableCell(nextCell, (direction)+6))))
			return nextCell;
	}
	else
	{
		nextNextCell1 = NextWalkableCell(nextCell, direction + 1);
		if (nextNextCell1 && Jump(nextNextCell1, goalCell, direction + 1, outIsCompleted, outMarkedDirection))
			return nextCell;

		nextNextCell2 = NextWalkableCell(nextCell, direction - 1);
		if (nextNextCell2 && Jump(nextNextCell2, goalCell, direction - 1, outIsCompleted, outMarkedDirection))
			return nextCell;
		/* can't walk through DIAGONAL block */
		if (!nextNextCell1 || !nextNextCell2)
			return nullptr;
	}

	nextNextCell3 = NextWalkableCell(nextCell, direction);
	return nextNextCell3 ? Jump(nextNextCell3, goalCell, direction, outIsCompleted, outMarkedDirection) : nullptr;
}
开发者ID:johndpope,项目名称:Medusa,代码行数:34,代码来源:JPSPlusPathFinder.cpp


示例2: cos

void Animal::Move(World &world)
{
	if (m_isAlive)
	{
		m_vitesse.x = 0.05;
		m_vitesse.z = 0.05;

		if (m_ClockTarget.getElapsedTime().asSeconds() < m_timeNextTarget)
		{
			Vector3<float> deplacementVector = Vector3<float>(sin(m_HorizontalRot / 180 * PI), 0.f, cos(m_HorizontalRot / 180 * PI));
			deplacementVector.Normalize();

			//Avance en x
			m_pos.x += deplacementVector.x * m_vitesse.x;
			if (CheckCollision(world))
			{
				m_pos.x -= deplacementVector.x * m_vitesse.x;
				Jump();
			}
			//En z
			m_pos.z += deplacementVector.z * m_vitesse.z;
			if (CheckCollision(world))
			{
				m_pos.z -= deplacementVector.z * m_vitesse.z;
				Jump();
			}
		}
		else
		{
			m_HorizontalRot += rand() % 200 - 100;
			m_timeNextTarget = rand() % 10;
			m_ClockTarget.restart();
		}



		//Chute
		m_pos.y -= m_vitesse.y;

		//Si collision
		if (CheckCollision(world))
		{

			//Si on a touche le sol 
			if (m_vitesse.y > 0)
				m_isInAir = false;

			//annule
			m_pos.y += m_vitesse.y;
			m_vitesse.y = 0;
		}
		else
			m_isInAir = true;

		//Acceleration
		m_vitesse.y += 0.013f;

	}
}
开发者ID:Domix24,项目名称:Cube,代码行数:59,代码来源:animal.cpp


示例3: Stupid

    inline int Stupid(int x,int y){
        if(d[x]>d[y])swap(x,y);
        int px=x,py=y,ans=0;
#define Jump(x) ans+=!v[COT2::a[x]],v[COT2::a[x]]=1,x=f[x]
        while(d[x]!=d[y])Jump(y);
        while(x!=y)Jump(x),Jump(y);
        ans+=!v[COT2::a[x]];
        while(px!=x)v[COT2::a[px]]=0,px=f[px];
        while(py!=y)v[COT2::a[py]]=0,py=f[py];
        return ans;
    }
开发者ID:jki14,项目名称:e.ICPC.SCL.13,代码行数:11,代码来源:ChairTree_COT2.cpp


示例4: Jump

void Entity::GoUpDown(float dt)
{
	if (mGoUp)
	{
		Jump(dt*movementMult);
		if (mPosition.y > mOrigY + mHeightToGo){ mGoUp = false; mGoDown = true; }
	}
	if (mGoDown)
	{
		Jump(-dt*movementMult);
		if (mPosition.y < mOrigY - mHeightToGo){ mGoUp = true; mGoDown = false; }
	}
}
开发者ID:JustinMorritt,项目名称:DudeWheresMyIQ,代码行数:13,代码来源:Entity.cpp


示例5: Gravity

void Fall_Block::NotStoped()
{
	Gravity();
	Move();
	Jump();
	Stop();
}
开发者ID:ryohalon,项目名称:Test,代码行数:7,代码来源:fall_block.cpp


示例6: while

// LexicalAnalyzer获取器,得到常数对应的Token
bool LexicalAnalyzer::GetConstantNumber(Token *result) {
  istr numberBuilder = "";
  bool successFlag = false;
  char c;
  // 扫描数字序列
  while (PTRnextLetter < (int)this->GetSourceCode().length()) {
    c = this->GetSourceCode()[PTRnextLetter];
    if ('0' <= c && c <= '9') {
      // 压数字
      numberBuilder += c;
      // 跳动游程
      Jump(1);
      successFlag = true;
    }
    else {
      break;
    }
  }
  // 成功得到了数字token
  if (successFlag) {
    result->aType = TokenType::number;
    result->detail = numberBuilder;
    result->aTag = atoi(numberBuilder.c_str());
    return true;
  }
  return false;
}
开发者ID:rinkako,项目名称:SSQLCompiler,代码行数:28,代码来源:ILexicalAnalyzer.cpp


示例7: if

void Player::Update(float deltaTime){
	animationTime+=deltaTime;
	isBlocking = false;
	if(KeyHandler::getKeys()->Key_Space)
	{
		Body->SetTransform(Body->GetPosition(),1.57079633f);
		isBlocking=true;
		jumpCharge=0;
	}
	else
	{
		Body->SetTransform(Body->GetPosition(),0);
		isBlocking=false;
		if(KeyHandler::getKeys()->Key_Up)
		{
			jumpCharge-=(jumpForceLevel+jumpCharge)/50;
		}
		else if(jumpCharge!=0)
		{
			Jump();
			jumpCharge=0;
			inAir = true;
		}
		if(KeyHandler::getKeys()->Key_Left)
			this->MoveLeft();
		if(KeyHandler::getKeys()->Key_Right)
			MoveRight();
	}


}
开发者ID:MarcMurphy,项目名称:TurtleSaga,代码行数:31,代码来源:Player.cpp


示例8: if

//=============================================================================
void CInsect::OnLoop(){
	CEntity::OnLoop();//entity version

	if(faceRight && SpeedY != 0) {//if its facing to the right and its moving in the y direction
		MoveRight = true;//make it move to the right
		MoveLeft = false;
	}
	else if (faceLeft && SpeedY != 0){//if its facing to the left and its moving in the y dirction
		MoveLeft = true;//make it move to the left
		MoveRight = false;
	}
	
	if (SpeedY == 0) {//if its not moving in the y direction
		MoveLeft = false;//make it stop moving in the x direction
		MoveRight = false;
	}	
	
	if(CanJump && jumpTimer >= 100) {//if it can jump and its jump timer is greater then 100 cycles
		jumpTimer = 0;//reset its jump timer
		Jump();//make it jump
	}	

	if(collisionTimer <= 100) collisionTimer++;//if its collision timer is less then 100 increment it
	
}
开发者ID:cbarron1,项目名称:Metrovania,代码行数:26,代码来源:CInsect.cpp


示例9: main

// main function
extern void main(void) {
    temp = 0;
    char buffer[9];
    // setup SYS interrupt
    aic_configure_irq(AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST,
                      AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE, aic_asm_sys_handler);
    // enable SYS interrupt
    aic_enable_irq(AT91C_ID_SYS);
    // setup rtt - 1Hz clock
    AT91C_BASE_ST->ST_RTMR = 0x4000;
    // setup rtt interrupt flag
    AT91C_BASE_ST->ST_IER = AT91C_ST_RTTINC;
    // enable RXRDY interrupt in DBGU
    AT91C_BASE_DBGU->DBGU_IER |= AT91C_US_RXRDY;
    while(!temp);
    delay(100000);
    util_int_to_hex(temp, buffer);
    if (temp > 0) {
        put_string("\n\nTransfer complete\n");
        put_string("Byte's sended: ");
        put_string(buffer);
        put_string("\n");
        put_string("Jump to loaded code\n");
        Jump((unsigned int)0x20000000);
    } else {
        put_string("Transfer failed\n");
    }
    // Infinity loop
    while (1) {
        // Disable pck for idle cpu mode
        AT91C_BASE_PMC->PMC_SCDR = AT91C_PMC_PCK;
    }
}
开发者ID:no111u3,项目名称:arm_my_learn,代码行数:34,代码来源:main.c


示例10: Jump

void ATopDown_HitmanCleanCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location){
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:esphung,项目名称:hitman-clean_prototype,代码行数:7,代码来源:TopDown_HitmanCleanCharacter.cpp


示例11: Jump

void BakaEngine::BakaJump(QStringList &args)
{
    if(args.empty())
        Jump();
    else
        InvalidParameter(args.join(' '));
}
开发者ID:wcy95,项目名称:Baka-MPlayer,代码行数:7,代码来源:bakacommands.cpp


示例12: Strafe

void Camera3::Update(double dt, bool* myKeys)
{/*
	Vector3 view = (target - position).Normalized();
	Vector3 right = view.Cross(up);
	right.y = 0;
	Inertia: instant dir change

	* strafe */
	if(myKeys[KEY_A] && !myKeys[KEY_D])
		Strafe(-dt);
	else if(straftMovingLeft)
		DecelerateLeft(-dt);

	if(myKeys[KEY_D] && !myKeys[KEY_A])
		Strafe(dt);
	else if(straftMovingRight)
		DecelerateRight(dt);

	/* walk */
	if(myKeys[KEY_W] && !myKeys[KEY_S])
		Walk(dt);
	else if(walkMovingForward)
		DecelerateForward(dt);

	if(myKeys[KEY_S] && !myKeys[KEY_W])
		Walk(-dt);
	else if(walkMovingBackward)
		DecelerateBackward(-dt);

	if(myKeys[KEY_C] && !croutching)
		croutching = true;

	croutch(dt);


	/* fly */
	if(myKeys[KEY_K])
		Fly(dt);
	if(myKeys[KEY_L])
		Fly(-dt);

	if(myKeys[KEY_SPACE] && !jump)	//com runs too fast, spacebar 2 times
		setJump(dt);

	if(myKeys[KEY_T])	//reset
	{
		Reset();
	}
	

	/** update jump **/
	if(jump)
		Jump(dt);
	

	/** mouse **/
	Yaw(dt);
	Pitch(dt);
}
开发者ID:barryHub20,项目名称:SP3,代码行数:59,代码来源:Camera3.cpp


示例13: Jump

void AaMazeInBear_protCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:MarcAndreFL,项目名称:AMazeInBear,代码行数:8,代码来源:aMazeInBear_protCharacter.cpp


示例14: Jump

void AWeaponEssentialsCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// Jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:CHADALAK1,项目名称:WeaponEssentials4.6,代码行数:8,代码来源:WeaponEssentialsCharacter.cpp


示例15: Jump

void AHeroesAndEmpiresCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:Rickdiculous,项目名称:HeroesAndEmpires,代码行数:8,代码来源:HeroesAndEmpiresCharacter.cpp


示例16: Jump

void AAITrainingStreamCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:Demoneyejin,项目名称:AITrainingStreamStuff,代码行数:8,代码来源:AITrainingStreamCharacter.cpp


示例17: Jump

void AUnrealMyoProjectCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:YutoNamiki,项目名称:UnrealMyoProject,代码行数:8,代码来源:UnrealMyoProjectCharacter.cpp


示例18: Jump

void ARewindableReplayDemoCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:jlucka625,项目名称:Rewindable-Replay-System,代码行数:8,代码来源:RewindableReplayDemoCharacter.cpp


示例19: Jump

void Animal::GetDamage(float damage)
{
	m_ClockAnimationDmg.restart();
	Jump();
	if (rand() % 100 > 66)
		Sound::Play(Sound::FLESH_IMPACT);
	Character::GetDamage(damage);
}
开发者ID:Domix24,项目名称:Cube,代码行数:8,代码来源:animal.cpp


示例20: Jump

/**
 * Handler for when a touch input begins.
 */
void AMutagenPlayer::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
	// jump, but only on the first touch
	if (FingerIndex == ETouchIndex::Touch1)
	{
		Jump();
	}
}
开发者ID:belven,项目名称:Mutagen,代码行数:11,代码来源:MutagenPlayer.cpp



注:本文中的Jump函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ K函数代码示例发布时间:2022-05-30
下一篇:
C++ JsonParse函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap