Esempio n. 1
0
void CCharacter::GoForward(float dTime)
{
	switch (m_Identity)
	{
	case ZOMBIE:
		m_Position = m_Position + NNPoint( (m_MovingSpeed), 0.0f) * dTime;
		break;
	case POLICE:
		m_Position = m_Position - NNPoint( (m_MovingSpeed), 0.0f) * dTime;
		break;
	default:
		break;
	}
	
}
Esempio n. 2
0
void CHumanInFarm::SetRandomPositionInFarm()
{
	int random_location_x = rand() % (SIZE_OF_HUMAN_FARM_X - 100);
	int random_location_y = rand() % (SIZE_OF_HUMAN_FARM_Y - 50);

	m_pSmallBaby->SetPosition( NNPoint(static_cast<float> (random_location_x + 20.0f), static_cast<float>(FIRST_Y_COORDINATE_OF_UIBUTTON + random_location_y)) );
}
Esempio n. 3
0
CPlayer::CPlayer()
	: mMoveVelocity(NNPoint(0,0)), mHp(100),
	  mRebirthDelayTime(10), mTeam(0), mKillScore(0),
	  mIsEmoticonRunning(false),
	  mNickname(nullptr)
{
	memset(mHasItem, false, sizeof(mHasItem));
}
Esempio n. 4
0
NNPoint NNInputSystem::GetMousePosition()
{
	POINT pt;
	GetCursorPos( &pt );
	ScreenToClient( NNApplication::GetInstance()->GetHWND(), &pt );

	return NNPoint((float)pt.x,(float)pt.y);
}
Esempio n. 5
0
File: Player.cpp Progetto: SlowT/CSM
CPlayer::CPlayer( void )
	: m_PlayerSprite(NULL),m_MoveDirection(NNPoint(0,0)),
	m_Hp(100),m_RebirthDelayTime(10)
{
	TransState(PlayerState::IDLE);

	m_PlayerUI = PlayerUI::Create();
	AddChild( m_PlayerUI );
}
Esempio n. 6
0
void CLightning::Update( float dTime )
{

	if(m_cloudSprite->GetPositionX() 
		< GAME_SCREEN_MAX_SIZE_X - 20 && !m_is_fall_lightning)
		m_cloudSprite->SetPosition
		(m_cloudSprite->GetPosition() 
		+ NNPoint(CLOUD_SPEED, 0.0f) * dTime);

	else if(!m_is_fall_lightning)
		m_cloudSprite->SetPosition(0.0f, POSITION_OF_CLOUD);


	m_currentTime = clock();
	if((NNInputSystem::GetInstance()->GetKeyState(VK_SPACE) == KEY_DOWN) && !m_is_fall_lightning
		&& (m_currentTime-m_startTime > LIGHTNING_COOL_TIME))
	{
		m_lightning_sprite->SetPosition(m_cloudSprite->GetPosition() - NNPoint(200,0));
		m_lightning_sprite->SetVisible(true);
		m_is_fall_lightning = true;
		m_startTime = m_currentTime;

		for (const auto& child : *CPlayScene::GetInstance()->GetPoliceList())
		{
			if(child != CPlayScene::GetInstance()->
				GetMapCreator()->GetPoliceBase())

				if(IsCrash(child))
				{
					child->SetHP(child->GetHP() - m_lightning_damage);
					m_stopTime = m_currentTime;
					break;
				}
			m_stopTime = m_currentTime;
		}
	}

	if(m_is_fall_lightning && m_currentTime - m_stopTime > 2000)
	{
		m_is_fall_lightning = false;
		m_lightning_sprite->SetVisible(false);

	}
}
Esempio n. 7
0
/*
정인호. 11/14
Attack_target과의 거리를 계산하여 그쪽 방향으로 접근하도록 함.
Issue : 기존에 존재하는 MakeCharacterWalk와 어떤식으로 연계될지
*/
void CCharacter::GoToAttackTarget(float dTime)
{
	float gap = m_Position.GetDistance(m_AttackTarget->GetPosition());
	float gap_x = m_AttackTarget->GetPositionX() - m_Position.GetX();
	float gap_y = m_AttackTarget->GetPositionY() - m_Position.GetY();
	float cosd = (gap_x) / gap;
	float sind = (gap_y) / gap;

	m_Position = m_Position + NNPoint( (m_MovingSpeed * cosd),( m_MovingSpeed * sind) )*dTime;	
}
Esempio n. 8
0
void CPlayerManager::UpdatePlayerInfo(PlayerInfo info)
{
	UpdatePlayerState(info.mPlayerId, info.mPlayerState);
	UpdatePlayerPosition(info.mPlayerId, NNPoint( info.mX, info.mY ) );
	UpdatePlayerRotation(info.mPlayerId, info.mAngle);
	UpdatePlayerMoveDirection(info.mPlayerId, info.mMoveVelocity);
	UpdatePlayerHP(info.mPlayerId, info.mHP);
	UpdatePlayerTeam(info.mPlayerId, info.mTeam);
	UpdatePlayerType(info.mPlayerId, (PlayerType)info.mType);
	//UpdatePlayerNickname(info.mPlayerId, info.mName);
	UpdatePlayerKillScore( info.mPlayerId, info.mKillScore );
}
Esempio n. 9
0
void NNParticle::Update( float dTime )
{
	m_NowLifeTime += dTime;

	m_Speed = m_StartSpeed + (m_EndSpeed-m_StartSpeed)*(m_NowLifeTime/m_LifeTime);
	m_RotationSpeed = m_StartRotationSpeed + (m_EndRotationSpeed-m_StartRotationSpeed)*(m_NowLifeTime/m_LifeTime);

	m_Position = m_Position + NNPoint( cos(NNDegreeToRadian(m_Direction)), sin(NNDegreeToRadian(m_Direction)) ) * m_Speed * dTime;
	m_Rotation += m_RotationSpeed * dTime;

	m_ScaleX = (m_StartScaleX + (m_EndScaleX-m_StartScaleX)*(m_NowLifeTime/m_LifeTime));
	m_ScaleY = (m_StartScaleY + (m_EndScaleY-m_StartScaleY)*(m_NowLifeTime/m_LifeTime));
	m_Color = (m_StartColor + (m_EndColor-m_StartColor)*(m_NowLifeTime/m_LifeTime));
}
AnimationSample::AnimationSample()
{
	m_Animation = NNAnimation::Create( 3, L"Resources/Texture/z1.png",
										L"Resources/Texture/z2.png", 
										L"Resources/Texture/z3.png");

	// 총 6장 애니메이션
	// 맨 앞이 텍스쳐 수, 뒤가 경로

	m_Animation->SetPosition( NNPoint(50.f,50.f) );

	// 행렬 연산 먹힘
	 
	AddChild( m_Animation );
}
Esempio n. 11
0
//맵 상 랜덤하게 뿌려지는 부분. 가능하면 전투가 자주 이뤄지는 구역(BattleLine)에 뿌려지도록 수정할 예정
NNPoint CMapObstacle::RandomMapPosition()
{
	return (NNPoint(static_cast<float>(rand() % (MAP_SIZE_X-1) * TILE_SIZE_X), static_cast<float>(FIRST_Y_COORDINATE_OF_MAPTILE + rand()%(MAP_SIZE_Y-1)*TILE_SIZE_Y)));
}
Esempio n. 12
0
void CLightning::Update( float dTime )
{
	//가만히 있으면 번개는 왼쪽으로 이동. 왼쪽 끝까지 이동하면 오른쪽 끝으로 다시 셋팅.
	if(m_lightning_sprite->GetVisible());

	else if(m_cloudSprite->GetPositionX() 
		< GAME_SCREEN_MAX_SIZE_X - 20 && !m_is_fall_lightning)
		m_cloudSprite->SetPosition
		(m_cloudSprite->GetPosition() 
		+ NNPoint(LIGHTNING_SPEED, 0.0f) * dTime);
	
	else if(!m_is_fall_lightning)
		m_cloudSprite->SetPosition(0.0f, POSITION_OF_LIGHTNING);
	
	


	m_currentTime = clock();
	
	//Space바가 눌렸는지를 체크. 눌렸으면 Flag를 True로 바꿔준다.
	if(NNInputSystem::GetInstance()->GetKeyState(VK_SPACE) == KEY_DOWN && !m_fall_lightning_sprite && (m_currentTime-m_startTime > LIGHTNING_COOL_TIME))
	{
		printf_s("put");
		m_is_fall_lightning = true;
		m_startTime = m_currentTime;
		
	}

	//현재 '떨어지고 있는 상태'라면 번개의 위치를 지속적으로 아래로 떨어지도록 변경
	if(m_is_fall_lightning)
	{
		//m_lightning_sprite->SetPosition
		//	(m_lightning_sprite->GetPosition() + NNPoint(0.0f, LIGHTNING_SPEED) *dTime);
		//Zombie와 Police를 돌면서 충돌 체크. 충돌하면 flag를 false로 바꾸고, 데미지 주고 번개 위치는 다시 0,0으로 셋팅
		m_lightning_sprite->SetPosition(m_cloudSprite->GetPosition());
		m_lightning_sprite->SetVisible(true);
		

		//Police만 맞도록 수정
		//for (const auto& child : *CPlayScene::GetInstance()->GetZombieList())
		//{
		//	//List에 Base가 존재. Base는 번개에 의해 데미지를 받으면 안되므로 제외하도록 설정
		//	if(child != CPlayScene::GetInstance()->
		//		GetMapCreator()->GetZombieBase())
		//		if(IsCrash(child))
		//		{
		//			child->SetHP(child->GetHP() - m_lightning_damage);
		//			m_is_fall_lightning = false;
		//				
		//			m_lightning_sprite->
		//				SetPosition(0.0f, POSITION_OF_LIGHTNING);
		//			break;
		//		}	
		//}
		
		for (const auto& child : *CPlayScene::GetInstance()->GetPoliceList())
		{
			if(child != CPlayScene::GetInstance()->
				GetMapCreator()->GetPoliceBase())
				if(IsCrash(child))
				{
					child->SetHP(child->GetHP() - m_lightning_damage);
					m_is_fall_lightning = false;

					m_lightning_sprite->
						SetPosition(0.0f, POSITION_OF_LIGHTNING);
					break;
				}
		}
		m_is_fall_lightning = false;

		
		////번개가 아무에게도 맞지 않고 아래로 끝까지 떨어지면 소멸 처리.
		//if(m_lightning_sprite->GetPositionY() >= FIRST_Y_COORDINATE_OF_UIBUTTON)
		//{
		//	m_is_fall_lightning = false;

		//	m_lightning_sprite->SetPosition(0.0f, POSITION_OF_LIGHTNING);
		//}

	}

	//연출을 위해 2초간 정지
	if(m_lightning_sprite->GetVisible() && m_currentTime - m_startTime > 2000){
		m_lightning_sprite->SetVisible(false);
	}
}
Esempio n. 13
0
NNPoint NNPoint::operator/( float n ) const
{
	return NNPoint( this->m_X/n, this->m_Y/n );
}
Esempio n. 14
0
NNPoint NNPoint::operator*( float n ) const
{
	return NNPoint( this->m_X*n, this->m_Y*n );
}
Esempio n. 15
0
NNPoint NNPoint::operator-() const
{
	return NNPoint( -this->m_X, -this->m_Y );
}
Esempio n. 16
0
NNPoint NNPoint::operator-( const NNPoint& point ) const
{
	return NNPoint( this->m_X-point.GetX(), this->m_Y-point.GetY() );
}