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

C++ changeAnimation函数代码示例

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

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



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

示例1: Projectile

	RayGun::Ray::Ray(byte playerNo, float x1, float y1) : Projectile(playerNo, x1, y1)
	{
		Animation*anim;
			
		anim = new Animation("left",1,"Images/Game/Items/RayGun/ray.png");
		addAnimation(anim);
			
		anim = new Animation("right",1,"Images/Game/Items/RayGun/ray.png");
		anim->mirror(true);
		addAnimation(anim);
		
		switch(itemdir)
		{
			case Player::LEFT:
			changeAnimation("left",FORWARD);
			xvelocity = -6;
			break;
				
			case Player::RIGHT:
			changeAnimation("right",FORWARD);
			xvelocity = 6;
			break;
		}
			
		startX = x;
	}
开发者ID:3Xpedite,项目名称:iSSB,代码行数:26,代码来源:RayGun.cpp


示例2: updateDoor

void updateDoor(door_struct* d)
{
	if(!d || !d->used)return;

	if(d->active)
	{
		if(d->modelInstance.currentAnim==0)
		{
			changeAnimation(&d->modelInstance, 2, false);
			changeAnimation(&d->modelInstance, 1, true);
			playSFX(doorOpenSFX);
		}else if(d->modelInstance.oldAnim==1 && d->modelInstance.currentAnim==2)
		{
			if(d->rectangle[0]){d->rectangle[0]->collides=false;toggleAAR(d->rectangle[0]->AARid);}
			if(d->rectangle[1]){d->rectangle[1]->collides=false;toggleAAR(d->rectangle[1]->AARid);}
		}
	}else
	{
		if(d->modelInstance.currentAnim==2)
		{
			changeAnimation(&d->modelInstance, 0, false);
			changeAnimation(&d->modelInstance, 3, true);
			playSFX(doorCloseSFX);
			if(d->rectangle[0]){d->rectangle[0]->collides=true;toggleAAR(d->rectangle[0]->AARid);}
			if(d->rectangle[1]){d->rectangle[1]->collides=true;toggleAAR(d->rectangle[1]->AARid);}
		}
	}

	updateAnimation(&d->modelInstance);
	d->active=false;
}
开发者ID:Almamu,项目名称:portalDS,代码行数:31,代码来源:door.c


示例3: ManageNONCombatModeAnimations

void ManageNONCombatModeAnimations() {
	arx_assert(entities.player());
	
	Entity *io = entities.player();

	AnimLayer & layer3 = io->animlayer[3];
	ANIM_HANDLE ** alist=io->anims;

	if(player.Current_Movement & (PLAYER_LEAN_LEFT | PLAYER_LEAN_RIGHT))
		return;

	if(ValidIONum(player.equiped[EQUIP_SLOT_SHIELD]) && !BLOCK_PLAYER_CONTROLS) {
		if ( (layer3.cur_anim==NULL)  ||
			( (layer3.cur_anim!=alist[ANIM_SHIELD_CYCLE])
			&& (layer3.cur_anim!=alist[ANIM_SHIELD_HIT])
			&& (layer3.cur_anim!=alist[ANIM_SHIELD_START]) ) )
		{
			changeAnimation(io, 3, alist[ANIM_SHIELD_START]);
		} else if(layer3.cur_anim==alist[ANIM_SHIELD_START] && (layer3.flags & EA_ANIMEND)) {
			changeAnimation(io, 3, alist[ANIM_SHIELD_CYCLE], EA_LOOP);
		}
	} else {
		if(layer3.cur_anim==alist[ANIM_SHIELD_CYCLE]) {
			changeAnimation(io, 3, alist[ANIM_SHIELD_END]);
		} else if(layer3.cur_anim == alist[ANIM_SHIELD_END] && (layer3.flags & EA_ANIMEND)) {
			layer3.cur_anim=NULL;
		}
	}
}
开发者ID:hulu1528,项目名称:ArxLibertatis,代码行数:29,代码来源:Core.cpp


示例4: getPlayer

	void BeamSword::onAnimationFinish(const String&name)
	{
		if(name.equals("swing_left") || name.equals("swing_right")
		|| name.equals("swing2_left") || name.equals("swing2_right"))
		{
			active = false;
			Player*playr = getPlayer();
			if(playr!=null)
			{
				switch(playr->getPlayerDir())
				{
					case Player::LEFT:
					changeAnimation("carry_left",FORWARD);
					break;
					
					case Player::RIGHT:
					changeAnimation("carry_right",FORWARD);
					break;
				}
			}
			else
			{
				changeAnimation("normal",FORWARD);
			}
		}
	}
开发者ID:Technologx2013,项目名称:iSSB,代码行数:26,代码来源:BeamSword.cpp


示例5: switch

void EnemyView::die()
{
	state_b = DEAD;

	switch(type)
	{
		case REBEL  : changeAnimation(REBEL_DEATH,false);  break;
		case BOWSER : changeAnimation(BOWSER_DEATH,false); break;
		case FLYING : changeAnimation(FLYING_DEATH,false); break;
	}
    
    srand(time(NULL));
    
    if(type == REBEL)
    {
		RebelSounds tmp_snd[3] = {REBEL_DEATH_SND, REBEL_DEATH2_SND, REBEL_DEATH3_SND};
		sounds[tmp_snd[rand()%3]]->play();
    }
    else if(type == BOWSER)
	{
		sounds[BOWSER_DEATH_SND]->play();
		sounds[BOWSER_DEATH2_SND]->play();
    }
    else if(type == FLYING)
    {
    	sounds[FLYING_DEATH_SND]->play();
    }
    
}
开发者ID:Jules5,项目名称:MetalSlug,代码行数:29,代码来源:EnemyView.cpp


示例6: changeAnimation

void EnemyView::shoot(list<AmmoView*>* air, Int2 angle)
{	
	if(state_b == DEAD)
		return;

	list<Ammo*> tmp;
	AmmoView* av;
	
	if(type == REBEL)
	{
		if(current_anim==REBEL_KNIFE && state_b==PRESHOOT)
		{
			Enemy::knife();
		}
		else
		{
			state_b = PRESHOOT;
			state_p = WAIT;
			save_air = air;
			save_angle = angle;
			changeAnimation(REBEL_KNIFE,false,REBEL_WATCH);
		}
	}

	else if(type == BOWSER)
	{
		if(current_anim==BOWSER_FIRE && state_b==PRESHOOT)
		{
			Enemy::shoot(&tmp,angle);
		}
		else
		{
			state_b = PRESHOOT;
			state_p = WAIT;
			save_air = air;
			save_angle = angle;
			changeAnimation(BOWSER_FIRE,false,BOWSER_STAND);
		}
	}

	else if(type == FLYING)
	{
		if(canShoot()) {
			Enemy::shoot(&tmp,angle);
		}
	}	

	for(list<Ammo*>::iterator a = tmp.begin(); a != tmp.end(); a++)
    {
    	av = new AmmoView(**a);
    	air->push_back(av);
    	tmp.erase(a++);
    }

}
开发者ID:Jules5,项目名称:MetalSlug,代码行数:55,代码来源:EnemyView.cpp


示例7: changeAnimation

void AmmoView::die(Int2 pos)
{
	Ammo::die(pos);

	if(type==BULLET || type==HEAVY_BULLET || type==LIGHT_BULLET)
		changeAnimation(1,false);
	else if(type==GRENADE)
	{
		initRotation();
		changeAnimation(1,false);
		sounds[GRENADE]->play();
	}
}
开发者ID:Jules5,项目名称:MetalSlug,代码行数:13,代码来源:AmmoView.cpp


示例8: Actor

	CharSelectScreen::CharCoin::CharCoin(CharSelectScreen*screen,int num) : Actor(0,0)
	{
		drag = false;
		dragId = 0;
		this->screen = screen;
		Animation*anim;
		switch(num)
		{
			default:
			anim = new Animation("normal",1,"Images/Menus/CharacterSelect/coins/coin.png");
			break;
			
			case 1:
			anim = new Animation("normal",1,"Images/Menus/CharacterSelect/coins/coin1.png");
			break;
			
			case 2:
			anim = new Animation("normal",1,"Images/Menus/CharacterSelect/coins/coin2.png");
			break;
			
			case 3:
			anim = new Animation("normal",1,"Images/Menus/CharacterSelect/coins/coin3.png");
			break;
			
			case 4:
			anim = new Animation("normal",1,"Images/Menus/CharacterSelect/coins/coin4.png");
			break;
		}
		addAnimation(anim);
		changeAnimation("normal",FORWARD);
	}
开发者ID:Carlanga,项目名称:iSSB,代码行数:31,代码来源:CharSelectScreen.cpp


示例9: setAlpha

	void OffScreenExplode::setActive()
	{
		active = true;
		setAlpha(0);
		changeAnimation("normal", FORWARD);
		Console::WriteLine("setting OffScreenExplode Active");
	}
开发者ID:3Xpedite,项目名称:iSSB,代码行数:7,代码来源:OffScreenExplode.cpp


示例10: changeAnimation

	void WinnerScreen::CharStat::CharStatPlayer::onAnimationFinish(const String&name)
	{
		if(name.equals((String)"win"))
		{
			changeAnimation("win_hold",FORWARD);
		}
	}
开发者ID:naha09,项目名称:iSSB,代码行数:7,代码来源:WinnerScreen.cpp


示例11: get_action

void Enemy::moveUp(int px)
{
	Action GoUp;
	GoUp.is_blocking = true;
	GoUp.thread_id = 1;
	Action AnimReset;
	AnimReset.is_blocking = true;
	AnimReset.thread_id = 1;

	GoUp.action = get_action([this, px](sf::Time dt)
	{
		if (getAnimationState() != static_cast<int>(Animations::GoUp))
		{
			animation.play();
			changeAnimation(static_cast<int>(Animations::GoUp));
			getAnimation().play();
		}
		return goUpUntil(px, dt);
	});

	AnimReset.action = get_action([this](sf::Time dt)
	{
		animation.reset();
		return false;
	});

	action_tree.push(GoUp);
	action_tree.push(AnimReset);
}
开发者ID:CarlosPerezPuertas,项目名称:Action-RPG,代码行数:29,代码来源:Enemy.cpp


示例12: changeAnimation

	void SmashBall::onAnimationFinish(const String&n)
	{
		if(n.equals("hit"))
		{
			changeAnimation("normal",FORWARD);
		}
	}
开发者ID:ChaiScript,项目名称:iSSB,代码行数:7,代码来源:SmashBall.cpp


示例13: ARX_EQUIPMENT_LaunchPlayerUnReadyWeapon

void ARX_EQUIPMENT_LaunchPlayerUnReadyWeapon() {
	arx_assert(entities.player());
	arx_assert(arrowobj);
	
	Entity * io = entities.player();
	
	ANIM_HANDLE * anim;
	WeaponType type = ARX_EQUIPMENT_GetPlayerWeaponType();

	switch(type) {
		case WEAPON_DAGGER:
			anim = io->anims[ANIM_DAGGER_UNREADY_PART_1];
			break;
		case WEAPON_1H:
			anim = io->anims[ANIM_1H_UNREADY_PART_1];
			break;
		case WEAPON_2H:
			anim = io->anims[ANIM_2H_UNREADY_PART_1];
			break;
		case WEAPON_BOW:
			anim = io->anims[ANIM_MISSILE_UNREADY_PART_1];
			EERIE_LINKEDOBJ_UnLinkObjectFromObject(io->obj, arrowobj);
			break;
		default:
			anim = io->anims[ANIM_BARE_UNREADY];
			break;
	}

	changeAnimation(io, 1, anim);
}
开发者ID:Mixone-FinallyHere,项目名称:ArxLibertatis,代码行数:30,代码来源:Equipment.cpp


示例14: ARX_EQUIPMENT_LaunchPlayerReadyWeapon

void ARX_EQUIPMENT_LaunchPlayerReadyWeapon() {
	arx_assert(entities.player());
	Entity *io = entities.player();
	
	WeaponType type = ARX_EQUIPMENT_GetPlayerWeaponType();
	ANIM_HANDLE * anim = NULL;

	switch(type) {
		case WEAPON_DAGGER:
			anim = io->anims[ANIM_DAGGER_READY_PART_1];
			break;
		case WEAPON_1H:
			anim = io->anims[ANIM_1H_READY_PART_1];
			break;
		case WEAPON_2H:
			if(!ValidIONum(player.equiped[EQUIP_SLOT_SHIELD]))
				anim = io->anims[ANIM_2H_READY_PART_1];

			break;
		case WEAPON_BOW:
			if(!ValidIONum(player.equiped[EQUIP_SLOT_SHIELD]))
				anim = io->anims[ANIM_MISSILE_READY_PART_1];

			break;
		default:
			anim = io->anims[ANIM_BARE_READY];
			break;
	}

	changeAnimation(io, 1, anim);
}
开发者ID:Mixone-FinallyHere,项目名称:ArxLibertatis,代码行数:31,代码来源:Equipment.cpp


示例15: updatePosition

/*---------------------------------------------------------------------------------*/
bool NPC::moveReset(const double& timeSinceLastFrame)
{
	//Updates the position here. Not as accurate as the method Player uses, but works fine.
	//See GameState::update to see how Player need two calls each update. One before and after physics timestep.
	updatePosition();

	//Get the direction to the spawnpoint
	Ogre::Vector3 dirNPCtoSpawnPoint = mtSpawnPoint - mtpCharNode->_getDerivedPosition();

	//Instead of length, use this approximation to check if the NPC is in range close enough of the spawn point
	//If so, the reset is done.
	if ((dirNPCtoSpawnPoint.x > -0.1 && dirNPCtoSpawnPoint.x < 0.1) && (dirNPCtoSpawnPoint.z > -0.1 && dirNPCtoSpawnPoint.z < 0.1))
	{
		mtReseting = false;
		//Returns true and tells the NPCHandler to delete it from a temporary Vector of reseting NPCs.
		return true;
	}
	//No movement in Y direciton
	dirNPCtoSpawnPoint.y = 0;
	//Movement velocity not dependent of the distance between Character and Camera.
	dirNPCtoSpawnPoint.normalise();

	//Make the NPC always face the spawn point when moving
	rotateCharacter(mtpCharNode,dirNPCtoSpawnPoint,*mtFaceDirection);

	//Animare and move the box
	changeAnimation("Walk", timeSinceLastFrame);
	mtpHitBox->setLinearVelocity(NxOgre::Vec3(dirNPCtoSpawnPoint.x*mtWalkSpeed ,mtpHitBox->getLinearVelocity().y,dirNPCtoSpawnPoint.z*mtWalkSpeed ));	
	
	//Returning false == no reset yet.
	return false;
}
开发者ID:dremerbuik,项目名称:projectkarma,代码行数:33,代码来源:NPC.cpp


示例16: changeAnimation

void Npc::moveUp(int px)
{
	Action GoUp;
	Action AnimReset;

	GoUp.action = get_action<Npc>([this, px](Npc &npc, sf::Time dt)
	{
		if (getAnimationState() != static_cast<int>(Animations::GoUp))
		{
			animation.play();
			changeAnimation(static_cast<int>(Animations::GoUp));
			getAnimation().play();
		}
		return goUpUntil(px);
	});

	AnimReset.action = get_action<Npc>([this](Npc &npc, sf::Time dt)
	{
		animation.reset();
		return false;
	});

	action_queue.push(GoUp);
	action_queue.push(AnimReset);
}
开发者ID:CarlosPerezPuertas,项目名称:Action-RPG,代码行数:25,代码来源:Npc.cpp


示例17: Item

	SmashBall::SmashBall(float x1, float y1) : Item(x1,y1, 40000,TYPE_WIELD)
	{
		moveTime = 0;
		speed = 1;
		hittable = true;
		unHittableTime = 0;
		health = 10;
		
		active = true;
		
		itemNo = Global::ITEM_SMASHBALL;

		readyFire = null;
		
		Animation*anim;
		
		anim = new Animation("normal", 5, 8, 1);
		anim->addFrame("Images/Game/Items/SmashBall/smashball.png");
		addAnimation(anim);
		
		anim = new Animation("hit", 6, 2, 1);
		anim->addFrame("Images/Game/Items/SmashBall/smashball_hit.png");
		addAnimation(anim);
		
		addFileResource("Images/Game/Items/SmashBall/finalsmash_fire.png");
		
		changeAnimation("normal",FORWARD);
		
		ignoreGoThroughPlatforms(true);
		setSolid(true);
		canBeCarried(false);
	}
开发者ID:ChaiScript,项目名称:iSSB,代码行数:32,代码来源:SmashBall.cpp


示例18: GameElement

	OffScreenExplode::OffScreenExplode(int playerNo) : GameElement(0,0)
	{
		this->playerNo = playerNo;
		active = false;
		addAnimation(new Animation("normal",1,"Images/Game/Misc/offscreen_explode.png"));
		changeAnimation("normal", FORWARD);
		setScale(1.1f);
	}
开发者ID:3Xpedite,项目名称:iSSB,代码行数:8,代码来源:OffScreenExplode.cpp


示例19: Item

	RayGun::RayGun(float x1, float y1) : Item(x1, y1, 20000, TYPE_HOLD)
	{
		itemNo = Global::ITEM_RAYGUN;
		
		weight = 0.2f;
		
		ammo = 16;
		active = false;
		activeTime = 0;
		attackType = 0;
		
		Animation*anim;
		
		anim = new Animation("left",1,"Images/Game/Items/RayGun/raygun.png");
		addAnimation(anim);
		
		anim = new Animation("right",1,"Images/Game/Items/RayGun/raygun.png");
		anim->mirror(true);
		addAnimation(anim);
		
		anim = new Animation("down_left",1,"Images/Game/Items/RayGun/raygun_down.png");
		addAnimation(anim);
		
		anim = new Animation("down_right",1,"Images/Game/Items/RayGun/raygun_down.png");
		anim->mirror(true);
		addAnimation(anim);
		
		dir = (byte)((GameEngine::random()*2)+1);
		
		switch(dir)
		{
			case Player::LEFT:
			changeAnimation("left",FORWARD);
			break;
			
			case Player::RIGHT:
			changeAnimation("right",FORWARD);
			break;
		}
		
		setHoldOffset(5, 1);
	}
开发者ID:3Xpedite,项目名称:iSSB,代码行数:42,代码来源:RayGun.cpp


示例20: controlUse

void controlUse(player_struct* p, bool down, bool held)
{
	if(!p || !down)return;

	if(!p->modelInstance.oneshot)
	{
		playSFX(gunSFX2);
		shootPlayerGun(p,false,1|2);
		changeAnimation(&p->modelInstance,1,true);
	}
}
开发者ID:Almamu,项目名称:portalDS,代码行数:11,代码来源:controls.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ changeBuffer函数代码示例发布时间:2022-05-30
下一篇:
C++ change函数代码示例发布时间: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