Пример #1
0
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;
	}

}
Пример #2
0
CGameScene::CGameScene() : time(0.0f), delay(1.5f)
{
	m_pBackground = new CBackground();
	PushScene(m_pBackground);
	m_pBoss = new CBoss();
	PushScene(m_pBoss);
	m_pBoss->SetPosition(App::WIDTH / 2 - m_pBoss->stand->width / 2 + 50, -1000);

	m_pFinalBoss = nullptr;
	m_pStandBoss = nullptr;
	m_pPlayer = new CPlayer();
	PushScene(m_pPlayer);
	m_pPlayer->SetPosition(App::WIDTH / 2 - m_pPlayer->normalAni->width / 2,
		App::HEIGHT - m_pPlayer->normalAni->height);

	m_pArrowScene = new CArrowScene();
	PushScene(m_pArrowScene);
	m_pEffectScene = new IScene();
	PushScene(m_pEffectScene);
	speed = 1.0f;

	CGSoundManager *sm = App::GetInstance()->g_pSoundManager;
	sm->AddSoundBuffer(sm->LoadWav(_T("resource/sounds/tok.wav")));
	sm->AddSoundBuffer(sm->LoadWav(_T("resource/sounds/play.wav")));
	sm->AddSoundBuffer(sm->LoadWav(_T("resource/sounds/potal.wav")));
	sm->Play(1, TRUE);

}
Пример #3
0
void CGameScene::Input(float eTime)
{
	CGSoundManager *sm = App::GetInstance()->g_pSoundManager;
	eTime *= speed;
	IScene::Input(eTime);
	if (App::GetInstance()->g_pInputManager->keyState(VK_LEFT) > 0)
	{
		m_pPlayer->Move(-300 * eTime);
		if (m_pPlayer->pos.x < 0) {
			m_pPlayer->pos.x = 0;
		}
	}
	if (App::GetInstance()->g_pInputManager->keyState(VK_RIGHT) > 0)
	{
		m_pPlayer->Move(300 * eTime);
		if (m_pPlayer->pos.x > (App::GetInstance()->WIDTH - 50)) {
			m_pPlayer->pos.x = (App::GetInstance()->WIDTH - 50);
		}
	}
	if (App::GetInstance()->g_pInputManager->keyState(VK_UP) > 0) {
		m_pPlayer->pos.y -= 200 * eTime;
		if (m_pPlayer->pos.y < 0) {
			m_pPlayer->pos.y = 0;
		}
	}
	if (App::GetInstance()->g_pInputManager->keyState(VK_DOWN) > 0) {
		m_pPlayer->pos.y += 200 * eTime;
	}
	if (App::GetInstance()->g_pInputManager->keyState(VK_SPACE) == 1) {
		sm->Play(2);
		if (speed == 1.0f) {
			speed = 0.0f;
		}
		else {
			speed = 1.0f;
		}
	}
	if (App::GetInstance()->g_pInputManager->keyState(VK_LSHIFT) ==1) {
		if (speed == 1.0f) {
			speed = 0.3f;
		}
		else if (speed == 0.0f) {
			speed = 0.0f;
		}
		else if (speed == 0.3f) {
			speed = 1.0f;
		}
	}
}
Пример #4
0
void CGameScene::Update(float eTime)
{
	CGSoundManager *sm = App::GetInstance()->g_pSoundManager;
	eTime *= speed;
	IScene::Update(eTime);
	time += eTime;
	bulletTime += eTime;
	if (time >= delay) {
		sm->Play(0);
		delay = 0.1;
		time = 0.f;
		this->PushArrow(rand() % App::WIDTH, -200.0f, -D3DX_PI / 2);
	}//총알

	if (m_pBoss == nullptr && m_pStandBoss != nullptr && bulletTime >= delay) {//에러메시지
		if (m_pStandBoss == nullptr)
			parent->PopScene(this);
		delay = 0.001;
		bulletTime = 0.f;
		switch (cnt) {
		case 30:
		case 31:
		case 32:
		case 33:
		case 34:
		case 35:
			for (int i = 0; i < 15; i++)
			{
				this->PushStandBullet(m_pStandBoss->pos.x + (i * 30),
					m_pStandBoss->pos.y + m_pStandBoss->StandBoss->height / 2,
					D3DX_PI / 2);
				//수직패턴
			}
			++cnt;
			break;
		case 50:
			for (int i = 0; i < 8; i++) {
				float angle = D3DX_PI / 2 - 0.1*(i - 4);
				this->PushStandBullet(m_pStandBoss->pos.x + m_pStandBoss->StandBoss->width / 2,
					m_pStandBoss->pos.y + m_pStandBoss->StandBoss->height / 2,
					angle);
			}
			cnt = 0;
			//방사형패턴 카운트 초기화 해주기 패턴 더 집어넣을거면 카운트 증가 시켜주기
			break;
		default:
			this->PushStandBullet(m_pStandBoss->pos.x + m_pStandBoss->StandBoss->width / 2,
				m_pStandBoss->pos.y + m_pStandBoss->StandBoss->height / 2,
				(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
			cnt++;
			break;
		}
	}
	//에러메시지 끝
	if (m_pBoss != nullptr && bulletTime >= delay) {		//창림
		if (m_pBoss == nullptr) {
			parent->PopScene(this);
		}
		delay = 0.005;
		bulletTime = 0.f;
		switch (cnt) {
		case 35:
		case 36:
		case 37:
		case 38:
		case 39:
		case 40:
		case 41:
		case 42:
		case 43:
		case 44:
		case 45:
		case 46:
		case 47:
		case 48:
		case 49:
		case 50:
			delay = 0.001;
			for (int i = 0; i < 2; i++) {
				this->PushBullet(m_pBoss->pos.x + 40 + (i * 40) + 115,
					m_pBoss->pos.y + 80,
					D3DX_PI / 2);
				/*this->PushBullet(m_pStandBoss->pos.x + m_pBoss->stand->width / 2,
					m_pBoss->pos.y + m_pBoss->stand->height / 2,
					angle);*/
			}
			delay = 0.05;
			++cnt;
			break;
		case 95:
			for (int i = 0; i < 8; i++) {
				float angle = D3DX_PI / 2 - 0.1*(i - 5);
				this->PushBullet(m_pBoss->pos.x + m_pBoss->stand->width / 2 - 52,
					m_pBoss->pos.y + m_pBoss->stand->height / 2 - 35,
					angle);
			}
			cnt = 0;
			break;
		default:
			this->PushBullet(m_pBoss->pos.x + m_pBoss->stand->width / 2 - 52,
				m_pBoss->pos.y + m_pBoss->stand->height / 2 - 35,
				(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
			++cnt;
			break;
		}
	}
	//창림끝

	//장석현
	if (m_pBoss == nullptr && m_pStandBoss == nullptr && bulletTime >= delay && m_pFinalBoss != nullptr) {
		if (m_pFinalBoss == nullptr) {
			parent->PopScene(this);
		}
		bulletTime = 0.f;
		delay = 0.0001;
			switch (cnt) {
			case 25:
			case 26:
			case 27:
			case 28:
			case 29:
			case 30:
			case 31:
			case 32:
			case 33:
			case 34:
			case 35:
				for (int i = 0; i < 15; i++)
				{
					this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width/2+(i * 30) - 350,
						m_pFinalBoss->pos.y + m_pFinalBoss->normal->height / 2,
						D3DX_PI / 2);
					//수직패턴
				}
				this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2 - 40,
					m_pFinalBoss->normal->pos.y + m_pFinalBoss->normal->height / 2,
					(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
				++cnt;
				break;
			case 50:
				for (int i = 0; i < 8; i++) {
					float angle = D3DX_PI / 2 - 0.1*(i - 4);
					this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2-40,
						m_pFinalBoss->pos.y + m_pFinalBoss->normal->height / 2,
						angle);
				}
				for (int i = 0; i < 8; i++) {
					float angle = D3DX_PI / 2 - 0.1*(i - 4);
					this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2 - 10,
						m_pFinalBoss->pos.y + m_pFinalBoss->normal->height / 2,
						angle);
				}
						cnt = 0;
						//방사형패턴 카운트 초기화 해주기 패턴 더 집어넣을거면 카운트 증가 시켜주기
						break;
			default:
				this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2 - 40,
					m_pFinalBoss->normal->pos.y + m_pFinalBoss->normal->height / 2,
					(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
				this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2 - 70,
					m_pFinalBoss->normal->pos.y + m_pFinalBoss->normal->height / 2,
					(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
				this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2 - 40 - 40,
					m_pFinalBoss->normal->pos.y + m_pFinalBoss->normal->height / 2,
					(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
				this->PushFinalBullet(m_pFinalBoss->normal->pos.x + m_pFinalBoss->normal->width / 2 - 70 - 40,
					m_pFinalBoss->normal->pos.y + m_pFinalBoss->normal->height / 2,
					(rand() % (int)(D3DX_PI * 1 * 100)) / 100.0f);
				cnt++;
					}
				}
	}