void HandleBombSequence() { if (BombCount < 40) { if (Unit *FireBomb = Unit::GetUnit((*me), FireBombGUIDs[BombCount])) { FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true); FireBomb->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } ++BombCount; if (BombCount == 40) { BombSequenceTimer = 5000; } else BombSequenceTimer = 100; } else { Boom(); isBombing = false; BombTimer = urand(20000,40000); me->RemoveAurasDueToSpell(SPELL_FIRE_BOMB_CHANNEL); if (EnrageTimer <= 10000) EnrageTimer = 0; else EnrageTimer -= 10000; } }
void HandleBombSequence() { if(BombCount < 40) { if(Unit *FireBomb = m_creature->GetMap()->GetUnit(FireBombGUIDs[BombCount])) { FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true); FireBomb->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } BombCount++; if(BombCount == 40) { BombSequenceTimer = 5000; } else BombSequenceTimer = 100; } else { Boom(); isBombing = false; BombTimer = 20000+rand()%20000; m_creature->RemoveAurasDueToSpell(SPELL_FIRE_BOMB_CHANNEL); if(EnrageTimer <= 10000) EnrageTimer = 0; else EnrageTimer -= 10000; } }
// float fDelta: 上一帧和当前帧的时间间隔,以秒为单位 BOOL CEventHandler::Frame(float fDelta) { // 在此添加游戏逻辑控制代码 if (g_pApp->Input_KeyPressed(VK_ESCAPE)) return TRUE; if (g_pApp->Input_KeyPressed(VK_LEFT)) g_fdx-=g_cfAcceleration*fDelta; if (g_pApp->Input_KeyPressed(VK_RIGHT)) g_fdx+=g_cfAcceleration*fDelta; if (g_pApp->Input_KeyPressed(VK_UP)) g_fdy-=g_cfAcceleration*fDelta; if (g_pApp->Input_KeyPressed(VK_DOWN)) g_fdy+=g_cfAcceleration*fDelta; g_fdx*=g_cfFriction; g_fdy*=g_cfFriction; g_fx+=g_fdx; g_fy+=g_fdy; if(g_fx>784) { g_fx=784-(g_fx-784); g_fdx=-g_fdx; Boom(); } if(g_fx<16) { g_fx=16+16-g_fx; g_fdx=-g_fdx; Boom(); } if(g_fy>584) { g_fy=584-(g_fy-584); g_fdy=-g_fdy; Boom(); } if(g_fy<16) { g_fy=16+16-g_fy; g_fdy=-g_fdy; Boom(); } g_pPar->m_Info.nEmission=(int)(g_fdx*g_fdx+g_fdy*g_fdy)*2; g_pPar->MoveTo(g_fx, g_fy); g_pPar->Update(fDelta); g_pSprTarg->SetTexture(g_pApp->Target_GetTexture(g_hTarg)); return FALSE; // 返回FALSE表示游戏未结束 }
void ChangeToPhase1() { // Set phase var mPhase = 1; // Play sound, and send text. /*_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Light, give me strength!"); ^^ Notes for myself */ Bubble(); Boom(); }
bool Save_Move(TC_Handle h,TC_Direction d)//安全移动 { int ONESTEP;//只有水平速度时的的绝对值 int OFFS;//预判步 TC_Hero hero; Tc_GetHeroInfo(h,&hero); if(hero.b_ghostball) { OFFS=20; } else { OFFS=20; } if(iFreeBall.b_visible=false||!Boom(&hero,d,OFFS))//当前不会碰 return Tc_Move(h,d); TC_Direction md1,md2; for(int i=1;i<=4;++i) { md1=DIR[(d+i)%8]; md2=DIR[(d+8-i)%8]; if(!Boom(&hero,md1,OFFS))//不被砸到 { if(Boom(&hero,md2,OFFS))//会砸到 return Tc_Move(h,md1); if(vdir[md1][0]*iFreeBall.speed.vx<0&&vdir[md1][1]*iFreeBall.speed.vy<0) return Tc_Move(h,md1);//md1与自由球反反向 else return Tc_Move(h,md2); } if(!Boom(&hero,md2,OFFS))//第一个会被砸到,第二个不会 return Tc_Move(h,md2); } return Tc_Move(h,d);//必被砸到 }
void Life(int x,int y,int life) { if(!life) { Boom(x,y); textcolor(LIGHTBLUE+BLINK); gotoxy(19,23); cprintf("þ S I M U L A T I O N T E R M I N A T E D þ"); getch(); exit(1); } }
void CMapObstacle::Update( float dTime ) { //Zombie리스트를 돌면서 좀비가 Obstacle에 닿았는지를 체크 for (const auto& child : *CPlayScene::GetInstance()->GetZombieList()) { if(child != CPlayScene::GetInstance()->GetMapCreator()->GetZombieBase() && IsCrash(child) ) { printf_s("Boom!\n"); Boom(child); break; } } }
void Bullet::Update(float dTime) { mLifeTime -= dTime; if(CouldBulletGoPosition(mRadius, mPosition + Point( cos(mAngle) * mVelocity , sin(mAngle) * mVelocity ) * dTime)) mPosition = mPosition + Point( cos(mAngle) * mVelocity , sin(mAngle) * mVelocity ) * dTime; else { Boom(); return; } mVelocity = mVelocity + mAcceleraction * dTime; printf("%.f %.f\n",mPosition.x,mPosition.y); }