Yaya
This commit is contained in:
		@@ -272,6 +272,10 @@ std::string Player::GetUsername() const { return m_username; }
 | 
			
		||||
 | 
			
		||||
float Player::GetHP() const { return m_hp; }
 | 
			
		||||
 | 
			
		||||
void Player::SetHP(float hp) {
 | 
			
		||||
	m_hp = hp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Player::Teleport(int& x, int& z) {
 | 
			
		||||
	m_position.x -= x * CHUNK_SIZE_X;
 | 
			
		||||
	m_position.z -= z * CHUNK_SIZE_Z;
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@ public:
 | 
			
		||||
	Vector3f GetPOV() const;
 | 
			
		||||
	std::string GetUsername() const;
 | 
			
		||||
	float GetHP() const;
 | 
			
		||||
	void SetHP(float hp);
 | 
			
		||||
	void Teleport(int& x, int& z);
 | 
			
		||||
 | 
			
		||||
	bool GetIsAirborne() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -117,10 +117,10 @@ Timestamp Connection::Run(World* world) {
 | 
			
		||||
	if (m_input_manifest.size() < 2)
 | 
			
		||||
		return tstamp;
 | 
			
		||||
 | 
			
		||||
	if (player->AmIDead()) {
 | 
			
		||||
		m_input_manifest.clear();
 | 
			
		||||
		return tstamp;
 | 
			
		||||
	}
 | 
			
		||||
	//if (player->AmIDead()) {
 | 
			
		||||
	//	m_input_manifest.clear();
 | 
			
		||||
	//	return tstamp;
 | 
			
		||||
	//}
 | 
			
		||||
 | 
			
		||||
	while (m_last_in < m_input_vector.size() - 1) {
 | 
			
		||||
		in = m_input_vector.at(m_last_in + 1);
 | 
			
		||||
@@ -131,7 +131,7 @@ Timestamp Connection::Run(World* world) {
 | 
			
		||||
		if (m_shoot_acc > 0.) {
 | 
			
		||||
			m_shoot_acc -= el;
 | 
			
		||||
			if (m_shoot_acc < 0.)
 | 
			
		||||
				m_shoot_acc = 0;
 | 
			
		||||
				m_shoot_acc = 0.;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		player->SetDirection(in.direction);
 | 
			
		||||
 
 | 
			
		||||
@@ -618,6 +618,7 @@ bool Engine::StartMultiplayerGame() {
 | 
			
		||||
			//m_world.SetSeed(m_conn.getSeed());
 | 
			
		||||
			m_world.SetSeed(9370707);
 | 
			
		||||
			m_networkgame = true;
 | 
			
		||||
			m_player.m_username = m_username;
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			std::cout << "Erreur de connexion." << std::endl;
 | 
			
		||||
@@ -1513,7 +1514,7 @@ void Engine::Render(float elapsedTime) {
 | 
			
		||||
							std::cout << sync.hp << std::endl;
 | 
			
		||||
							m_otherplayerpos = sync.position;
 | 
			
		||||
	
 | 
			
		||||
							m_player.InflictDamage(sync.hp - m_player.GetHP());
 | 
			
		||||
							m_player.SetHP(sync.hp);
 | 
			
		||||
 | 
			
		||||
							Vector3f diff = sync.position - comp.position;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user