本文整理汇总了C++中Animation::SetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::SetPos方法的具体用法?C++ Animation::SetPos怎么用?C++ Animation::SetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animation
的用法示例。
在下文中一共展示了Animation::SetPos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateOrientedAnimations
//Seq is the cycle to use in case of single orientations
//Aim is the number of Orientations
void Projectile::CreateOrientedAnimations(Animation **anims, AnimationFactory *af, int Seq)
{
for (int Cycle = 0; Cycle<MAX_ORIENT; Cycle++) {
bool mirror = false, mirrorvert = false;
int c;
switch(Aim) {
default:
c = Seq;
break;
case 5:
c = SixteenToFive[Cycle];
// orientations go counter-clockwise, starting south
if (Cycle <= 4) {
// bottom-right quadrant
mirror = false; mirrorvert = false;
} else if (Cycle <= 8) {
// top-right quadrant
mirror = false; mirrorvert = true;
} else if (Cycle < 12) {
// top-left quadrant
mirror = true; mirrorvert = true;
} else {
// bottom-left quadrant
mirror = true; mirrorvert = false;
}
break;
case 9:
c = SixteenToNine[Cycle];
if (Cycle>8) mirror=true;
break;
case 16:
c=Cycle;
break;
}
Animation* a = af->GetCycle( c );
anims[Cycle] = a;
if (!a) continue;
//animations are started at a random frame position
//Always start from 0, unless set otherwise
if (!(ExtFlags&PEF_RANDOM)) {
a->SetPos(0);
}
if (mirror) {
a->MirrorAnimation();
}
if (mirrorvert) {
a->MirrorAnimationVert();
}
a->gameAnimation = true;
}
}
示例2: CreateCompositeAnimation
//Seq is the first cycle to use in the composite
//Aim is the number of cycles
void Projectile::CreateCompositeAnimation(Animation **anims, AnimationFactory *af, int Seq)
{
for (int Cycle = 0; Cycle<Aim; Cycle++) {
int c = Cycle+Seq;
Animation* a = af->GetCycle( c );
anims[Cycle] = a;
if (!a) continue;
//animations are started at a random frame position
//Always start from 0, unless set otherwise
if (!(ExtFlags&PEF_RANDOM)) {
a->SetPos(0);
}
a->gameAnimation = true;
}
}
示例3: Init
void Stage_Ending::Init()
{
timer = 0;
TextureManager::GetSingleton().Add(L"data\\ending\\background.png");
TextureManager::GetSingleton().Add(L"data\\ending\\flag.png");
TextureManager::GetSingleton().Init();
Entity *newEntity = new Entity(L"data\\ending\\background.png", 800, 600);
newEntity->SetPos(0, 0);
entities.push_back(newEntity);
Animation *newAnimation = new Animation(L"data\\ending\\flag.png", 2000, 120, 1, 20);
newAnimation->SetPos(236, 200);
newAnimation->Play(15.0f, true);
entities.push_back(newAnimation);
}
示例4: if
void Stage_Stage3::UpdateEntities(Entity *entity, float deltaTime)
{
Animation *anim;
Particle *part;
GameStateManager& gameState = GameStateManager::GetSingleton();
AnimationAdder& animAddr = AnimationAdder::GetSingleton();
ParticleAdder& particleAddr = ParticleAdder::GetSingleton();
#pragma region Scrollingbackground
if ( entity->Params["Type"] == "ScrollingBackground" )
{
//entity->XSpeedEmergencyModder = gameState.State["Speed"] * -50.0f;
if ( entity->X <= -800 )
{
entity->X += 800;
}
}
#pragma endregion WEEEEEEEEE
#pragma region ShopItem
else if ( entity->Params["Type"] == "ShopItem" )
{
if ( gameState.State["Score"] >= gameState.State[entity->Params["Name"]] )
{
((Animation*)entity)->Play(10.0f, false);
}
else
{
((Animation*)entity)->Play(-10.0f, false);
}
if ( entity->Params["Name"] == "Shop_Power" && gameState.State["Power"] == 1 )
{
entity->Y = 600;
}
else if ( entity->Params["Name"] == "Shop_Power" )
{
entity->Y = 528;
}
else if ( entity->Params["Name"] == "Shop_Weapon" && gameState.State["Weapon"] == 1 )
{
entity->Y = 600;
}
else if ( entity->Params["Name"] == "Shop_Weapon" )
{
entity->Y = 528;
}
else if ( entity->Params["Name"] == "Shop_Addon" && gameState.State["Addon"] == 2 )
{
entity->Y = 600;
}
else if ( entity->Params["Name"] == "Shop_Addon" )
{
entity->Y = 528;
}
}
#pragma endregion ShopItem
#pragma region PlayerAddon
else if ( entity->Params["Type"] == "PlayerAddon" )
{
if ( entity->Params["Name"] == "AddonUpper" )
{
if ( gameState.State["Addon"] >= 2 )
{
entity->SetPos((float)gameState.State["PlayerX"], (float)gameState.State["PlayerY"] - 15);
}
else
{
entity->SetPos((float)-13371337, (float)-13371337);
}
}
else if ( entity->Params["Name"] == "AddonLower" )
{
if ( gameState.State["Addon"] >= 1 )
{
entity->SetPos((float)gameState.State["PlayerX"], (float)gameState.State["PlayerY"] + 50);
}
else
{
entity->SetPos((float)-13371337, (float)-13371337);
}
}
}
#pragma endregion Player Addons!
#pragma region PlayerPlane
if ( entity->Params["Name"] == "PlayerPlane" )
{
((Player*)entity)->MoveSpeedMod = gameState.State["Speed"] * 10.0f;
gameState.State["PlayerX"] = (int)entity->X;
gameState.State["PlayerY"] = (int)entity->Y;
gameState.State["Health"] = entity->Health;
if ( gameState.State["PlayerMode"] )
{
entity->Params["Switching"] = "True";
}
else
{
//.........这里部分代码省略.........
示例5: Entity
void Stage_Stage3::Init()
{
stageOverTimer = 0;
boatTimer = 0;
stageClearTimer = 0;
bulletCount = 0;
GameStateManager::GetSingleton().Init();
Entity *newEntity;
#pragma region Texture
TextureManager& tm = TextureManager::GetSingleton();
tm.Add(T_BACKGROUND_1);
tm.Add(T_BACKGROUND_2);
tm.Add(T_BACKGROUND_3);
tm.Add(T_BACKGROUND_4);
tm.Add(T_BACKGROUND_5);
tm.Add(T_ENEMY_1);
tm.Add(T_ENEMY_2);
tm.Add(T_ENEMY_3);
tm.Add(T_ENEMY_BOAT);
tm.Add(T_ENEMY_BOSS);
tm.Add(T_EXPLOSION);
tm.Add(T_EXPLOSION_BIG);
tm.Add(T_PLAYER);
tm.Add(T_PLAYER_BOAT);
tm.Add(T_PLAYER_ADDON);
tm.Add(T_BULLET);
tm.Add(T_BOAT_BULLET);
tm.Add(T_BULLET_2);
tm.Add(T_BULLET2_EXPLOSION);
tm.Add(T_BULLET_SHELL);
tm.Add(T_BULLET_EXPLOSION);
tm.Add(T_UI_BACKGROUND_1);
tm.Add(T_UI_BACKGROUND_2);
tm.Add(T_UI_BAR_HEALTH);
tm.Add(T_UI_BAR_EXP);
tm.Add(T_UI_SHOP_POWER);
tm.Add(T_UI_SHOP_MORESPEED);
tm.Add(T_UI_SHOP_SPEED);
tm.Add(T_UI_SHOP_ADDON);
tm.Add(T_UI_SHOP_WEAPON);
tm.Add(T_UI_BAR_BOSS);
tm.Add(T_UI_GAMEOVER);
tm.Add(T_UI_BAR_BOSS_BG);
tm.Add(T_UI_BAR_BOSS_BG_BLACK);
tm.Add(T_UI_CLEAR);
tm.Add(T_DOKDO);
tm.Add(T_HP);
tm.Init();
#pragma endregion Texture
#pragma region Background
newEntity = new Entity(T_BACKGROUND_1, 800, 600);
newEntity->SetPos(0, 0);
entities.push_back(newEntity);
newEntity = new Entity(T_DOKDO, 454, 209);
newEntity->SetPos(200, 300);
newEntity->Params["Name"] = "Dokdo";
newEntity->SetSpeed(-30, 0, 0, 0);
entities.push_back(newEntity);
newEntity = new Entity(T_BACKGROUND_2, 1600, 600);
newEntity->SetPos(0, 0);
newEntity->Params["Type"] = "ScrollingBackground";
newEntity->SetSpeed(-150, 0, 0, 0);
entities.push_back(newEntity);
newEntity = new Entity(T_BACKGROUND_3, 1600, 600);
newEntity->SetPos(0, 0);
newEntity->Params["Type"] = "ScrollingBackground";
newEntity->SetSpeed(-200, 0, 0, 0);
entities.push_back(newEntity);
newEntity = new Entity(T_BACKGROUND_4, 1600, 600);
newEntity->SetPos(0, 0);
newEntity->Params["Type"] = "ScrollingBackground";
newEntity->SetSpeed(-250, 0, 0, 0);
entities.push_back(newEntity);
newEntity = new Entity(T_BACKGROUND_5, 1600, 600);
newEntity->SetPos(0, 0);
newEntity->Params["Type"] = "ScrollingBackground";
newEntity->SetSpeed(-300, 0, 0, 0);
entities.push_back(newEntity);
#pragma endregion Background
#pragma region Player
AddNewPlayer();
AddNewPlayerBoat();
Animation *newAddon = new Animation(T_PLAYER_ADDON, 150, 17, 1, 6);
newAddon->Params["Type"] = "PlayerAddon";
newAddon->Params["Name"] = "AddonUpper";
newAddon->Play(30.0f, true);
entities.push_back(newAddon);
newAddon = new Animation(T_PLAYER_ADDON, 150, 17, 1, 6);
newAddon->Params["Type"] = "PlayerAddon";
newAddon->Params["Name"] = "AddonLower";
newAddon->Play(30.0f, true);
entities.push_back(newAddon);
//.........这里部分代码省略.........