void CEnemy1::Update(float eTime) { IEnemy::Update(eTime); CGameScene *gs = (CGameScene*)this->parent->parent; if (hp <= 0) { CParticleSystem *p = gs->PushEffect(pos.x + ani->width/2, pos.y + ani->height/2 + 55.0f); p->setScalep(4.0f, 5.0f); p->direction = -90; p->spread = 30; p->setSpeed(400.0f, 700.0f); p->start(); CGSoundManager * sm = App::GetInstance()->g_pSoundManager; sm->Play(2); this->parent->PopScene(this); return; } time += eTime; time2 += eTime; if (pos.y < 50) { pos.y += 150 * eTime; if (pos.y > 50) pos.y = 50; } if (time > 3.0f) { gs->PushEffect(this->pos.x+20, this->pos.y + 140); gs->PushArrow(this->pos.x - 65, this->pos.y + 170, D3DX_PI / 2); gs->PushArrow(this->pos.x - 65, this->pos.y + 170, D3DX_PI / 2 - 0.4); gs->PushArrow(this->pos.x - 65, this->pos.y + 170, D3DX_PI / 2 + 0.4); time = 0.f; } if (time2 > 7.0f) { pos.y += 700 * eTime; } if (pos.y > App::HEIGHT) { this->parent->PopScene(this); return; } }
void CArrow::Update(float eTime) { IScene::Update(eTime); pos.x += cos(rot) * speed * eTime; pos.y += sin(rot) * speed * eTime; if (pos.y > App::HEIGHT + 200) { this->parent->PopScene(this); return; } RECT arrowRect, playerRect, tempRect; //RECT ¼³Á¤ arrowRect.left = pos.x + rotatingCenter.x - 1; arrowRect.right = pos.x + rotatingCenter.x + 1; arrowRect.top = pos.y + rotatingCenter.y - 1; arrowRect.bottom = pos.y + rotatingCenter.y + 1; CGameScene *gs = (CGameScene*)this->parent->parent; CPlayer *player = gs->m_pPlayer; playerRect.left = player->pos.x; playerRect.right = player->pos.x + player->normalAni->width; playerRect.top = player->pos.y; playerRect.bottom = player->pos.y + player->normalAni->height; // if (IntersectRect(&tempRect, &playerRect, &arrowRect) == true) { CParticleSystem *p = gs->PushEffect(pos.x + rotatingCenter.x, pos.y + rotatingCenter.y); p->start(); this->parent->PopScene(this); return; } }
void CFinalBullet::Update(float eTime) { IScene::Update(eTime); pos.x += cos(rot)*speed*eTime; pos.y += sin(rot)*speed * eTime; if (pos.y > App::HEIGHT + 200) { this->parent->PopScene(this); return; } RECT bulletRect, playerRect, tempRect; bulletRect.left = pos.x + rotatingCenter.x - 1; bulletRect.right = pos.x + rotatingCenter.x + 1; bulletRect.top = pos.y + rotatingCenter.y - 1; bulletRect.bottom = pos.y + rotatingCenter.y + 1; CGameScene *gs = (CGameScene*)this->parent->parent; CPlayer *player = gs->m_pPlayer; playerRect.left = player->pos.x + 45; playerRect.right = player->pos.x + player->normalAni->width - 45; playerRect.top = player->pos.y; playerRect.bottom = player->pos.y + player->normalAni->height - 90; if (IntersectRect(&tempRect, &playerRect, &bulletRect) == true) { player->p_Blood -= 2; gs->PushEffect(pos.x + rotatingCenter.x, pos.y + rotatingCenter.y); this->parent->PopScene(this); return; } }
void CArrow::Update(float eTime) { IScene::Update(eTime); CGameScene * gs = (CGameScene*)this->parent; CPlayer *player = gs->m_pPlayer; //this->rot = atan2((player->pos.y + player->normalAni->height / 2) - (this->pos.y + this->rotatingCenter.y), (player->pos.x + player->normalAni->width / 2) - (this->pos.x + this->rotatingCenter.x)); pos.x += cos(rot) * speed * eTime; pos.y += sin(rot) * speed * eTime; if (pos.y > App::HEIGHT + ani->width){ this->parent->PopScene(this); return; } RECT arrowRect; arrowRect.left = pos.x + this->rotatingCenter.x - 1; arrowRect.right = pos.x + this->rotatingCenter.x + 1; arrowRect.top = pos.y + this->rotatingCenter.y - 1; arrowRect.bottom = pos.y + this->rotatingCenter.y + 1; RECT playerRect; playerRect.left = player->pos.x + 10; playerRect.top = player->pos.y + 10; playerRect.right = player->pos.x + player->normalAni->width - 10; playerRect.bottom = player->pos.y + player->normalAni->height - 10; RECT tmpRect; if (IntersectRect(&tmpRect, &arrowRect, &playerRect)) { gs->PushEffect(pos.x + this->rotatingCenter.x, pos.y + this->rotatingCenter.y); this->parent->PopScene(this); return; } }