Example #1
0
void Commands::sellHouse(Player& player, const std::string& param)
{
	Player* tradePartner = g_game.getPlayerByName(param);
	if (!tradePartner || tradePartner == &player) {
		player.sendCancelMessage("Trade player not found.");
		return;
	}

	if (!Position::areInRange<2, 2, 0>(tradePartner->getPosition(), player.getPosition())) {
		player.sendCancelMessage("Trade player is too far away.");
		return;
	}

	if (!tradePartner->isPremium()) {
		player.sendCancelMessage("Trade player does not have a premium account.");
		return;
	}

	HouseTile* houseTile = dynamic_cast<HouseTile*>(player.getTile());
	if (!houseTile) {
		player.sendCancelMessage("You must stand in your house to initiate the trade.");
		return;
	}

	House* house = houseTile->getHouse();
	if (!house || house->getOwner() != player.getGUID()) {
		player.sendCancelMessage("You don't own this house.");
		return;
	}

	if (g_game.map.houses.getHouseByPlayerId(tradePartner->getGUID())) {
		player.sendCancelMessage("Trade player already owns a house.");
		return;
	}

	if (IOLoginData::hasBiddedOnHouse(tradePartner->getGUID())) {
		player.sendCancelMessage("Trade player is currently the highest bidder of an auctioned house.");
		return;
	}

	Item* transferItem = house->getTransferItem();
	if (!transferItem) {
		player.sendCancelMessage("You can not trade this house.");
		return;
	}

	transferItem->getParent()->setParent(&player);

	if (!g_game.internalStartTrade(&player, tradePartner, transferItem)) {
		house->resetTransferItem();
	}
}
Example #2
0
Point Player::playerNextPos()
{
	Player tmp;
	tmp.setPosition(this->playerPosition);
	tmp.changeDirection(this->playerDirection);
	tmp.playerMove();
	return tmp.getPosition();
}
Example #3
0
void SoundEngine::dead(int playerId) {
	Player* player = dynamic_cast<Player*>(Globals::gameObjects.playerMap[playerId]);
	FMOD::Channel* channel = nullptr;
	glm::vec3 pos = player->getPosition();
	FMOD_VECTOR position = { pos.x, pos.y, pos.z };
	result_ = system_->playSound(deadSound_, 0, true, &channel);
	result_ = channel->set3DAttributes(&position, 0);
	result_ = channel->setPaused(false);
}
Example #4
0
bool Map::isBirdCollision(const Player& player) const
{
  if(player.isCrouched())
    return false;

  const sf::Vector2f player_pos = player.getPosition();
  const sf::Vector2f bird_pos   = _bird.getPosition();
  return isCollide( player_pos.x, player_pos.x + player.getWidth(),
                    bird_pos.x, bird_pos.x + _bird.getGlobalBounds().width );
}
Example #5
0
bool ConditionRegeneration::executeCondition(Creature* creature, int32_t interval)
{
	internalHealthTicks += interval;
	internalManaTicks += interval;

	if (creature->getZone() != ZONE_PROTECTION) {
		if (internalHealthTicks >= healthTicks) {
			internalHealthTicks = 0;

			int32_t realHealthGain = creature->getHealth();
			creature->changeHealth(healthGain);
			realHealthGain = creature->getHealth() - realHealthGain;

			if (isBuff && realHealthGain > 0) {
				Player* player = creature->getPlayer();
				if (player) {
					std::ostringstream ss;
					ss << ucfirst(player->getNameDescription()) << " was healed for " << realHealthGain << " hitpoint" << (realHealthGain != 1 ? "s." : ".");
					std::string message = ss.str();

					std::ostringstream tmpSs;
					tmpSs << "You were healed for " << realHealthGain << " hitpoint" << (realHealthGain != 1 ? "s." : ".");
					player->sendHealMessage(MESSAGE_HEALED, tmpSs.str(), player->getPosition(), realHealthGain, TEXTCOLOR_MAYABLUE);

					SpectatorVec list;
					g_game.getSpectators(list, player->getPosition(), false, true);
					for (Creature* spectator : list) {
						if (spectator != player) {
							spectator->getPlayer()->sendHealMessage(MESSAGE_HEALED_OTHERS, message, player->getPosition(), realHealthGain, TEXTCOLOR_MAYABLUE);
						}
					}
				}
			}
		}

		if (internalManaTicks >= manaTicks) {
			internalManaTicks = 0;
			creature->changeMana(manaGain);
		}
	}

	return ConditionGeneric::executeCondition(creature, interval);
}
Example #6
0
bool Map::isTreeCollision(const Player& player) const
{
  // Only check first tree
  const sf::Sprite& tree           = _trees.front();
  const sf::Vector2f& tree_pos     = tree.getPosition();
  const sf::Vector2f& player_pos   = player.getPosition();
  const sf::FloatRect& tree_bounds = tree.getGlobalBounds();

  // If higher than tree, no collision
  if( player_pos.y < tree_pos.y - tree_bounds.height )
    return false;

  return isCollide(player_pos.x, player_pos.x + player.getWidth(),
                   tree_pos.x, tree_pos.x + tree_bounds.width);
}
Example #7
0
void TextLayer::update(float dt)
{
	Player *player = (Player*)world->getObjectByType(OBJECT_PLAYER);
	assert(player != nullptr);

	CCPoint pos = player->getPosition();
	float tileX = pos.x / 32.0f;
	float tileY = pos.y / 32.0;

	char buffer[256];
	sprintf(buffer, "Pos : %.2f, %.2f", pos.x, pos.y);
	positionLabel->setString(buffer);

	sprintf(buffer, "Tile: %.2f, %.2f", tileX, tileY);
	tileCoordLabel->setString(buffer);

	sprintf(buffer, "HP  : %d / %.1f", player->hp, player->powerfulTime);
	hpLabel->setString(buffer);

	sprintf(buffer, "Avail: %d / %.1f", customAction->GetSpecialCount(), customAction->GetSpecialGap());
	availCountLabel->setString(buffer);

	if(preHP != player->hp)
	{
		preHP = player->hp;
		for(int i = 0; i < 3; i++)
		{
			if(i < preHP)
				heartSprite[i]->setVisible(true);
			else
				heartSprite[i]->setVisible(false);
		}
	}

	if(preSpecialCount != customAction->GetSpecialCount())
	{
		preSpecialCount = customAction->GetSpecialCount();
		for(int i = 0; i < 5; i++)
		{
			if(i < preSpecialCount)
				specialGuage[i]->setVisible(true);
			else
				specialGuage[i]->setVisible(false);
		}
	}

}
void MachineGun::createShots(const Player& player, Shot**& shots, uint32_t& nbShots)
{
	shots = (Shot**)realloc(shots, (nbShots+1)*sizeof(Shot*));
	if(player.getOrientation() == AHEAD)
	{
		shots[nbShots] = new MachineBullet(this, &m_shotMaterial, MACHINEBULLET_SPEED);
		shots[nbShots]->setPositionOrigin(glm::vec3(0.5, 0.0, 0.0), true);
	}
	else
	{
		shots[nbShots] = new MachineBullet(this, &m_shotMaterial, -MACHINEBULLET_SPEED);
		shots[nbShots]->setPositionOrigin(glm::vec3(0.5, 1.0, 0.0), true);
	}

	shots[nbShots]->setPosition(player.getPosition(true));
	nbShots++;
}
Example #9
0
void PlayerManager::ConvertPlayer2Package(Player& player,GamePackage_Player& pack_player)
{
	pack_player.set_userid(player.GetID());
	pack_player.set_speed(player.GetSpeed());
	pack_player.set_direction(player.GetDirection());
	pack_player.set_destpointx(player.GetDestPoint().x);
	pack_player.set_destpointy(player.GetDestPoint().y);
	pack_player.set_currentpointx(player.getPosition().x);
	pack_player.set_currentpointy(player.getPosition().y);
	pack_player.set_msgcode(player.GetMsg());

	pack_player.set_bloodvalue(player.GetBloodValue());
	pack_player.set_maxbloodvalue(player.GetMaxBloodValue());
	pack_player.set_magicvalue(player.GetMagicValue());
	pack_player.set_maxmagicvalue(player.GetMaxMagicValue());
	pack_player.set_empiricalvalue(player.GetEmpiricalValue());
	pack_player.set_maxempiricalvalue(player.GetMaxEmpiricalValue());
	pack_player.set_level(player.GetLevel());
	pack_player.set_damagevalue(player.GetDamageValue());
	//pack_player.set_skill(player.GetCurrentSkill()->GetSkillID());
}
Example #10
0
void SoundEngine::punch(int playerId) {
	Player* player = dynamic_cast<Player*>(Globals::gameObjects.playerMap[playerId]);
	FMOD::Channel* channel = punchChannels[playerId];

	glm::vec3 pos = player->getPosition();
	FMOD_VECTOR position = { pos.x, pos.y, pos.z };

	if (channel) {
		bool playing = false;
		channel->isPlaying(&playing);
		if (playing) {
			channel->set3DAttributes(&position, 0);
			return;
		}
	}

	result_ = system_->playSound(punchSound_, 0, true, &channel);
	punchChannels[playerId] = channel;
	result_ = channel->set3DAttributes(&position, 0);
	result_ = channel->setPaused(false);
}
Example #11
0
File: house.cpp Project: CkyLua/tfs
bool House::kickPlayer(Player* player, const std::string& name)
{
	Player* kickingPlayer = g_game.getPlayerByName(name);
	if(kickingPlayer)
	{
		HouseTile* houseTile = dynamic_cast<HouseTile*>(kickingPlayer->getTile());
		if(houseTile && houseTile->getHouse() == this)
		{
			if(getHouseAccessLevel(player) >= getHouseAccessLevel(kickingPlayer) && !kickingPlayer->hasFlag(PlayerFlag_CanEditHouses))
			{
				Position oldPosition = kickingPlayer->getPosition();
				if(g_game.internalTeleport(kickingPlayer, getEntryPosition()) == RET_NOERROR)
				{
					g_game.addMagicEffect(oldPosition, NM_ME_POFF);
					g_game.addMagicEffect(getEntryPosition(), NM_ME_TELEPORT);
				}
				return true;
			}
		}
	}
	return false;
}
Example #12
0
void Window::updatePlayers()
{
	Game* g = Game::instance();
	Player *p = Game::getPuckHolder();
	Player *h = g->getHomeTeamPlayers(), *a = g->getAwayTeamPlayers();

	// Get positions of the green players
	Math::Vector2D<double> greenPos = h->getPosition();

	// Get positions of the blue players
	Math::Vector2D<double> bluePos = a->getPosition();
	
	// Set up new positions
	blueRect.x = floor(bluePos.x) - withPuck.w/2; blueRect.y = floor(bluePos.y) - withPuck.h/2;
	blueNameRect.x = blueRect.x; blueNameRect.y = withPuck.h + blueRect.y;
	greenRect.x = floor(greenPos.x) - withPuck.w/2; greenRect.y = floor(greenPos.y) - withPuck.h/2;
	greenNameRect.x = greenRect.x; greenNameRect.y = withPuck.h + greenRect.y;

	// Blit surfaces
	if (p == h)
	{
		SDL_BlitSurface(greenPlayer, &withPuck, mainSurface, &greenRect);
		SDL_BlitSurface(bluePlayer, &withoutPuck, mainSurface, &blueRect);
	}
	else if (p == a)
	{
		SDL_BlitSurface(greenPlayer, &withoutPuck, mainSurface, &greenRect);
		SDL_BlitSurface(bluePlayer, &withPuck, mainSurface, &blueRect);
	}
	else
	{
		SDL_BlitSurface(greenPlayer, &withoutPuck, mainSurface, &greenRect);
		SDL_BlitSurface(bluePlayer, &withoutPuck, mainSurface, &blueRect);
	}

	// Render the player names
	drawText(&blueNameRect, nameFont, a->getName().c_str());
	drawText(&greenNameRect, nameFont, h->getName().c_str());
}
bool ConditionRegeneration::executeCondition(Creature* creature, int32_t interval)
{
	internalHealthTicks += interval;
	internalManaTicks += interval;

	if (creature->getZone() == ZONE_PROTECTION) {
		return ConditionGeneric::executeCondition(creature, interval);
	}

	if (internalHealthTicks >= healthTicks) {
		internalHealthTicks = 0;

		int32_t realHealthGain = creature->getHealth();
		creature->changeHealth(healthGain);
		realHealthGain = creature->getHealth() - realHealthGain;

		if (isBuff && realHealthGain > 0) {
			Player* player = creature->getPlayer();
			if (player) {
				std::string healString = std::to_string(realHealthGain) + (realHealthGain != 1 ? " hitpoints." : " hitpoint.");

				TextMessage message(MESSAGE_HEALED, "You were healed for " + healString);
				message.position = player->getPosition();
				message.primary.value = realHealthGain;
				message.primary.color = TEXTCOLOR_MAYABLUE;
				player->sendTextMessage(message);

				SpectatorHashSet spectators;
				g_game.map.getSpectators(spectators, player->getPosition(), false, true);
				spectators.erase(player);
				if (!spectators.empty()) {
					message.type = MESSAGE_HEALED_OTHERS;
					message.text = player->getName() + " was healed for " + healString;
					for (Creature* spectator : spectators) {
						spectator->getPlayer()->sendTextMessage(message);
					}
				}
			}
		}
	}

	if (internalManaTicks >= manaTicks) {
		internalManaTicks = 0;

		if (Player* player = creature->getPlayer()) {
			int32_t realManaGain = player->getMana();
			player->changeMana(manaGain);
			realManaGain = player->getMana() - realManaGain;

			if (isBuff && realManaGain > 0) {
				std::string manaGainString = std::to_string(realManaGain);

				TextMessage message(MESSAGE_HEALED, "You gained " + manaGainString + " mana.");
				message.position = player->getPosition();
				message.primary.value = realManaGain;
				message.primary.color = TEXTCOLOR_MAYABLUE;
				player->sendTextMessage(message);

				SpectatorHashSet spectators;
				g_game.map.getSpectators(spectators, player->getPosition(), false, true);
				spectators.erase(player);
				if (!spectators.empty()) {
					message.type = MESSAGE_HEALED_OTHERS;
					message.text = player->getName() + " gained " + manaGainString + " mana.";
					for (Creature* spectator : spectators) {
						spectator->getPlayer()->sendTextMessage(message);
					}
				}
			}
		}
	}

	return ConditionGeneric::executeCondition(creature, interval);
}
Example #14
0
void RemoteClient::GetNextBlocks (
		ServerEnvironment *env,
		EmergeManager * emerge,
		float dtime,
		std::vector<PrioritySortedBlockTransfer> &dest)
{
	DSTACK(FUNCTION_NAME);


	// Increment timers
	m_nothing_to_send_pause_timer -= dtime;
	m_nearest_unsent_reset_timer += dtime;

	if(m_nothing_to_send_pause_timer >= 0)
		return;

	Player *player = env->getPlayer(peer_id);
	// This can happen sometimes; clients and players are not in perfect sync.
	if(player == NULL)
		return;

	// Won't send anything if already sending
	if(m_blocks_sending.size() >= g_settings->getU16
			("max_simultaneous_block_sends_per_client"))
	{
		//infostream<<"Not sending any blocks, Queue full."<<std::endl;
		return;
	}

	v3f playerpos = player->getPosition();
	v3f playerspeed = player->getSpeed();
	v3f playerspeeddir(0,0,0);
	if(playerspeed.getLength() > 1.0*BS)
		playerspeeddir = playerspeed / playerspeed.getLength();
	// Predict to next block
	v3f playerpos_predicted = playerpos + playerspeeddir*MAP_BLOCKSIZE*BS;

	v3s16 center_nodepos = floatToInt(playerpos_predicted, BS);

	v3s16 center = getNodeBlockPos(center_nodepos);

	// Camera position and direction
	v3f camera_pos = player->getEyePosition();
	v3f camera_dir = v3f(0,0,1);
	camera_dir.rotateYZBy(player->getPitch());
	camera_dir.rotateXZBy(player->getYaw());

	/*infostream<<"camera_dir=("<<camera_dir.X<<","<<camera_dir.Y<<","
			<<camera_dir.Z<<")"<<std::endl;*/

	/*
		Get the starting value of the block finder radius.
	*/

	if(m_last_center != center)
	{
		m_nearest_unsent_d = 0;
		m_last_center = center;
	}

	/*infostream<<"m_nearest_unsent_reset_timer="
			<<m_nearest_unsent_reset_timer<<std::endl;*/

	// Reset periodically to workaround for some bugs or stuff
	if(m_nearest_unsent_reset_timer > 20.0)
	{
		m_nearest_unsent_reset_timer = 0;
		m_nearest_unsent_d = 0;
		//infostream<<"Resetting m_nearest_unsent_d for "
		//		<<server->getPlayerName(peer_id)<<std::endl;
	}

	//s16 last_nearest_unsent_d = m_nearest_unsent_d;
	s16 d_start = m_nearest_unsent_d;

	//infostream<<"d_start="<<d_start<<std::endl;

	u16 max_simul_sends_setting = g_settings->getU16
			("max_simultaneous_block_sends_per_client");
	u16 max_simul_sends_usually = max_simul_sends_setting;

	/*
		Check the time from last addNode/removeNode.

		Decrease send rate if player is building stuff.
	*/
	m_time_from_building += dtime;
	if(m_time_from_building < g_settings->getFloat(
				"full_block_send_enable_min_time_from_building"))
	{
		max_simul_sends_usually
			= LIMITED_MAX_SIMULTANEOUS_BLOCK_SENDS;
	}

	/*
		Number of blocks sending + number of blocks selected for sending
	*/
	u32 num_blocks_selected = m_blocks_sending.size();

	/*
		next time d will be continued from the d from which the nearest
		unsent block was found this time.

		This is because not necessarily any of the blocks found this
		time are actually sent.
	*/
	s32 new_nearest_unsent_d = -1;

	const s16 full_d_max = g_settings->getS16("max_block_send_distance");
	s16 d_max = full_d_max;
	s16 d_max_gen = g_settings->getS16("max_block_generate_distance");

	// Don't loop very much at a time
	s16 max_d_increment_at_time = 2;
	if(d_max > d_start + max_d_increment_at_time)
		d_max = d_start + max_d_increment_at_time;

	s32 nearest_emerged_d = -1;
	s32 nearest_emergefull_d = -1;
	s32 nearest_sent_d = -1;
	//bool queue_is_full = false;

	s16 d;
	for(d = d_start; d <= d_max; d++) {
		/*
			Get the border/face dot coordinates of a "d-radiused"
			box
		*/
		std::vector<v3s16> list = FacePositionCache::getFacePositions(d);

		std::vector<v3s16>::iterator li;
		for(li = list.begin(); li != list.end(); ++li) {
			v3s16 p = *li + center;

			/*
				Send throttling
				- Don't allow too many simultaneous transfers
				- EXCEPT when the blocks are very close

				Also, don't send blocks that are already flying.
			*/

			// Start with the usual maximum
			u16 max_simul_dynamic = max_simul_sends_usually;

			// If block is very close, allow full maximum
			if(d <= BLOCK_SEND_DISABLE_LIMITS_MAX_D)
				max_simul_dynamic = max_simul_sends_setting;

			// Don't select too many blocks for sending
			if (num_blocks_selected >= max_simul_dynamic) {
				//queue_is_full = true;
				goto queue_full_break;
			}

			// Don't send blocks that are currently being transferred
			if (m_blocks_sending.find(p) != m_blocks_sending.end())
				continue;

			/*
				Do not go over-limit
			*/
			if (blockpos_over_limit(p))
				continue;

			// If this is true, inexistent block will be made from scratch
			bool generate = d <= d_max_gen;

			{
				/*// Limit the generating area vertically to 2/3
				if(abs(p.Y - center.Y) > d_max_gen - d_max_gen / 3)
					generate = false;*/

				// Limit the send area vertically to 1/2
				if (abs(p.Y - center.Y) > full_d_max / 2)
					continue;
			}

			/*
				Don't generate or send if not in sight
				FIXME This only works if the client uses a small enough
				FOV setting. The default of 72 degrees is fine.
			*/

			float camera_fov = (72.0*M_PI/180) * 4./3.;
			if(isBlockInSight(p, camera_pos, camera_dir, camera_fov, 10000*BS) == false)
			{
				continue;
			}

			/*
				Don't send already sent blocks
			*/
			{
				if(m_blocks_sent.find(p) != m_blocks_sent.end())
				{
					continue;
				}
			}

			/*
				Check if map has this block
			*/
			MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);

			bool surely_not_found_on_disk = false;
			bool block_is_invalid = false;
			if(block != NULL)
			{
				// Reset usage timer, this block will be of use in the future.
				block->resetUsageTimer();

				// Block is dummy if data doesn't exist.
				// It means it has been not found from disk and not generated
				if(block->isDummy())
				{
					surely_not_found_on_disk = true;
				}

				// Block is valid if lighting is up-to-date and data exists
				if(block->isValid() == false)
				{
					block_is_invalid = true;
				}

				if(block->isGenerated() == false)
					block_is_invalid = true;

				/*
					If block is not close, don't send it unless it is near
					ground level.

					Block is near ground level if night-time mesh
					differs from day-time mesh.
				*/
				if(d >= 4)
				{
					if(block->getDayNightDiff() == false)
						continue;
				}
			}

			/*
				If block has been marked to not exist on disk (dummy)
				and generating new ones is not wanted, skip block.
			*/
			if(generate == false && surely_not_found_on_disk == true)
			{
				// get next one.
				continue;
			}

			/*
				Add inexistent block to emerge queue.
			*/
			if(block == NULL || surely_not_found_on_disk || block_is_invalid)
			{
				if (emerge->enqueueBlockEmerge(peer_id, p, generate)) {
					if (nearest_emerged_d == -1)
						nearest_emerged_d = d;
				} else {
					if (nearest_emergefull_d == -1)
						nearest_emergefull_d = d;
					goto queue_full_break;
				}

				// get next one.
				continue;
			}

			if(nearest_sent_d == -1)
				nearest_sent_d = d;

			/*
				Add block to send queue
			*/
			PrioritySortedBlockTransfer q((float)d, p, peer_id);

			dest.push_back(q);

			num_blocks_selected += 1;
		}
	}
queue_full_break:

	// If nothing was found for sending and nothing was queued for
	// emerging, continue next time browsing from here
	if(nearest_emerged_d != -1){
		new_nearest_unsent_d = nearest_emerged_d;
	} else if(nearest_emergefull_d != -1){
		new_nearest_unsent_d = nearest_emergefull_d;
	} else {
		if(d > g_settings->getS16("max_block_send_distance")){
			new_nearest_unsent_d = 0;
			m_nothing_to_send_pause_timer = 2.0;
		} else {
			if(nearest_sent_d != -1)
				new_nearest_unsent_d = nearest_sent_d;
			else
				new_nearest_unsent_d = d;
		}
	}

	if(new_nearest_unsent_d != -1)
		m_nearest_unsent_d = new_nearest_unsent_d;
}
Example #15
0
//===================================================================//
//==================Main Method=====================================//
//==================================================================//
int main()
{

	//===================================================================//
	//==================Things you need to start with====================//
	//==================================================================//
	glfwInit();

	Window testWindow(500, 50, 800, 600, "Demo");
	glfwMakeContextCurrent(testWindow.getWindow());

	// Callback
	glfwSetKeyCallback(testWindow.getWindow(), key_callback);

	cam.setKeySpeed(2.0);
	cam.setNearFar(0.01, 100);

	glewInit();

	OpenGL3Context context;
	//renderer = new Renderer(context);
	Renderer renderer(context);

	//===================================================================//
	//==================Shaders for your program========================//
	//==================================================================//
	VertexShader vs(loadShaderSource(SHADERS_PATH + std::string("/Vertex-Shaders/TextureShader3D.vert")));
	FragmentShader fs(loadShaderSource(SHADERS_PATH + std::string("/Fragment-Shaders/TextureShader3D.frag")));
	ShaderProgram shader(vs, fs);

	VertexShader vsGBuffer(loadShaderSource(SHADERS_PATH + std::string("/GBuffer/GBuffer.vert")));
	FragmentShader fsGBuffer(loadShaderSource(SHADERS_PATH + std::string("/GBuffer/GBuffer.frag")));
	ShaderProgram shaderGBuffer(vsGBuffer, fsGBuffer);

	VertexShader vsSfq(loadShaderSource(SHADERS_PATH + std::string("/ScreenFillingQuad/ScreenFillingQuad.vert")));
	FragmentShader fsSfq(loadShaderSource(SHADERS_PATH + std::string("/ScreenFillingQuad/ScreenFillingQuad.frag")));
	ShaderProgram shaderSFQ(vsSfq, fsSfq);

	VertexShader vsSkybox(loadShaderSource(SHADERS_PATH + std::string("/SkyboxShader/SkyboxShader.vert")));
	FragmentShader fsSkybox(loadShaderSource(SHADERS_PATH + std::string("/SkyboxShader/SkyboxShader.frag")));
	ShaderProgram shaderSkybox(vsSkybox, fsSkybox);

	FBO fboGBuffer(WINDOW_WIDTH, WINDOW_HEIGHT, 3, true, false);

	SoundFileHandler sfh = SoundFileHandler(1000);

	Rect screenFillingQuad;
	screenFillingQuad.loadBufferData();

	//===================================================================//
	//==================Object declarations - Geometry, Texture, Node=== //
	//==========================Object: Terrain===========================//

	StaticObject terrainObject;
	terrainObject.setClassType(ClassType::TERRAIN);

	Texture terrainTex((char*)RESOURCES_PATH "/Grass2.jpg");

	Terrain terrain2((char*)RESOURCES_PATH "/heightmap.jpg", 0.0f, 0.0f);
	Node terrainNode2("Terrain");
	terrainNode2.addGeometry(&terrain2);
	terrainNode2.addTexture(&terrainTex);
	terrainNode2.setObject(&terrainObject);


	//===================================================================//
	//==================Object declarations - Geometry, Texture, Node=== //
	//==========================Object: Player===========================//

	Texture texCV((char*)RESOURCES_PATH "/cv_logo.bmp");

	GekoMesh gekoMesh;
	geko.setExp(0.0);
	geko.setLevelThreshold(100.0);
	geko.setLevel(0);

	Node playerNode("Player");

	playerNode.addGeometry(&gekoMesh);
	playerNode.setObject(&geko);
	playerNode.addTexture(&texCV);

	sfh.generateSource(glm::vec3(geko.getPosition()), RESOURCES_PATH "/Sound/Rascheln.wav");
	geko.setSoundHandler(&sfh);
	geko.setSourceName(MOVESOUND, "SpielerFootsteps", RESOURCES_PATH "/Sound/Rascheln.wav");
	//geko.setSourceName(BACKGROUNDMUSIC, "Hintergrund", RESOURCES_PATH "/Sound/jingle2.wav");
	geko.setSourceName(FIGHTSOUND, "Kampfsound", RESOURCES_PATH "/Sound/punch.wav");
	geko.setSourceName(EATSOUND, "Essen", RESOURCES_PATH "/Sound/Munching.wav");
	geko.setSourceName(QUESTSOUND, "Quest", RESOURCES_PATH "/Sound/jingle.wav");
	geko.setSourceName(ITEMSOUND, "Item", RESOURCES_PATH "/Sound/itempickup.wav");
	geko.setSourceName(FIRESOUND, "Fire", RESOURCES_PATH "/Sound/Feuer_kurz.wav");

	sfh.disableLooping("Essen");
	sfh.disableLooping("Quest");
	sfh.disableLooping("Item");
	geko.setPosition(glm::vec4(terrain2.getResolutionX() / 2.0f, 10.0f, terrain2.getResolutionY() / 2.0f, 1.0));
	//sfh.generateSource("Feuer",posFood, RESOURCES_PATH "/Sound/Feuer kurz.wav");
	playerNode.setCamera(&cam);

	//===================================================================//
	//==================Setting up the Level and Scene==================//
	//==================================================================//

	Level testLevel("testLevel");
	Scene testScene("testScene");
	testLevel.addScene(&testScene);
	testLevel.changeScene("testScene");
	testLevel.setTerrain(&terrain2);

	//==================Add Camera to Scene============================//
	testScene.getScenegraph()->addCamera(&cam);
	testScene.getScenegraph()->setActiveCamera("PlayerViewCam");

	//==================Set Input-Maps and activate one================//
	iH.setAllInputMaps(*(testScene.getScenegraph()->getActiveCamera()));
	iH.changeActiveInputMap(MapType::OBJECT);
	iH.getActiveInputMap()->update(geko);

	//==================Add Objects to the Scene=======================//
	//==================Update the Bounding-Sphere 1st time============//
	/*Node translateNode("Translate");
	translateNode.addTranslation(glm::vec3(terrain2.getResolutionX() / 2.0f, 0.0, terrain2.getResolutionY() / 2.0f));*/

	testScene.getScenegraph()->getRootNode()->addChildrenNode(&terrainNode2);
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&playerNode);
	//testScene.getScenegraph()->getRootNode()->addChildrenNode(&translateNode);
	//testScene.getScenegraph()->getRootNode()->getChildrenNode("Translate")->addChildrenNode(&playerNode);



	//===================================================================//
	//==================Setting up the Observers========================//
	//==================================================================//

	ObjectObserver playerObserver(&testLevel);
	SoundObserver soundPlayerObserver(&testLevel);
	geko.addObserver(&playerObserver);
	geko.addObserver(&soundPlayerObserver);


	// ==============================================================
	// == Object (Forest) ==========================================
	// ==============================================================
	TreeMesh tree;

	glm::vec3 tmp;
	std::stringstream name;
	for (int i = 0; i<TreeData::forest1.size(); i++)
	{
		name << "Forest1Tree" << i;
		std::string stringname = name.str();
		StaticObject *treeStatic = new StaticObject();
		treeStatic->setTree(50 / TreeData::forest1.size());
		Node *treeNode = new Node(stringname);
		treeNode->addGeometry(&tree);
		treeNode->setObject(treeStatic);
		tmp.x = TreeData::forest1[i].x;
		tmp.z = TreeData::forest1[i].z;
		tmp.y = terrain2.getHeight(glm::vec2(tmp.x, tmp.z));
		treeNode->addTranslation(tmp);
		treeNode->getBoundingSphere()->radius = 2.5;
		testScene.getScenegraph()->getRootNode()->addChildrenNode(treeNode);
		name.str("");
	}
	for (int i = 0; i<TreeData::forest2.size(); i++)
	{
		name << "Forest2Tree" << i;
		std::string stringname = name.str();
		StaticObject *treeStatic = new StaticObject();
		treeStatic->setTree(50 / TreeData::forest2.size());
		Node *treeNode = new Node(stringname);
		treeNode->addGeometry(&tree);
		treeNode->setObject(treeStatic);

		tmp.x = TreeData::forest2[i].x;
		tmp.z = TreeData::forest2[i].z;
		tmp.y = terrain2.getHeight(glm::vec2(tmp.x, tmp.z));
		treeNode->addTranslation(tmp);
		treeNode->getBoundingSphere()->radius = 2.5;
		testScene.getScenegraph()->getRootNode()->addChildrenNode(treeNode);
		name.str("");
	}

	// ==============================================================
	// == Object (Anthome) ==========================================
	// ==============================================================
	glm::vec3 posFood(10.0, 0.0, -5.0);
	glm::vec3 posFood2((terrain2.getResolutionX() / 2.0f) + 10.0, 0.0, (terrain2.getResolutionY() / 2.0f) - 5.0);
	glm::vec3 posSpawn(terrain2.getResolutionX() / 2.0f, 10.0, terrain2.getResolutionY() / 2.0f);
	glm::vec3 posDefaultPlayer(0.0, 0.0, 0.0);
	AntMesh antMesh;

	DecisionTree *aggressivedecisionTree = new DecisionTree();
	aggressivedecisionTree->setAntTreeAggressiv();

	DecisionTree *afraidDecisionTree = new DecisionTree();
	afraidDecisionTree->setAntTreeAfraid();

	Graph<AStarNode, AStarAlgorithm>* antAggressiveGraph = new Graph<AStarNode, AStarAlgorithm>();
	antAggressiveGraph->setExampleAntAggressiv(posSpawn, posFood2, posDefaultPlayer);

	Graph<AStarNode, AStarAlgorithm>* antAfraidGraph = new Graph<AStarNode, AStarAlgorithm>();
	antAfraidGraph->setExampleAntAfraid2(posSpawn, posDefaultPlayer);

	AntHome antHome(posSpawn, antMesh, &playerObserver, &texCV, &texCV, aggressivedecisionTree, antAggressiveGraph, afraidDecisionTree, antAfraidGraph);
	//antHome.generateGuards(5, &aiObserver, testScene.getScenegraph()->getRootNode());
	antHome.generateWorkers(5, testScene.getScenegraph()->getRootNode());
	/*antHome.addAntsToSceneGraph(testScene.getScenegraph()->getRootNode());*/





	//===================================================================//
	//==================Setting up the Collision=========================//
	//==================================================================//
	CollisionTest collision;
	collision.collectNodes(testScene.getScenegraph()->getRootNode());

	CollisionObserver colObserver(&testLevel);
	collision.addObserver(&colObserver);
	collision.addObserver(&soundPlayerObserver);

	GravityObserver gravityObserver(&testLevel);
	collision.addObserver(&gravityObserver);



	//===================================================================//
	//==================Setting up the Gravity===========================//
	//==================================================================//
	Gravity gravity;
	playerNode.addGravity(&gravity);

	//===================================================================//
	//==================Setting up the Gravity===========================//
	//==================================================================//
	PlayerGUI playerGUI(HUD_WIDTH, HUD_HEIGHT, WINDOW_HEIGHT, WINDOW_WIDTH, QUEST_HEIGHT, QUEST_WIDTH, playerNode.getPlayer());

	//===================================================================//
	//==================The Render-Loop==================================//
	//==================================================================//
	float lastTime = glfwGetTime();

	sfh.playSource("Hintergrund");
	sfh.setGain("Hintergrund", 0.5f);


	//TODO adjust the Rotation,to match the Terrain
	glm::vec4 tmpPos;
	glm::vec3 normalFromTerrain;
	glm::vec3 rotateAxis;
	glm::vec4 viewDirFromPlayer;
	glm::vec3 up(0.0, 1.0, 0.0);
	float lengthFromNormal;
	float lengthFromUp;
	float phi;



	while (!glfwWindowShouldClose(testWindow.getWindow()))
	{


		float currentTime = glfwGetTime();
		float deltaTime = currentTime - lastTime;
		lastTime = currentTime;


		//===================================================================//
		//==================Update your Objects per Frame here =============//
		//==================================================================//
		collision.update();


		//===================================================================//
		//==================Input and update for the Player==================//
		//==================================================================//

		geko.update();
		geko.setDeltaTime(currentTime);

		tmpPos = testScene.getScenegraph()->searchNode("Player")->getPlayer()->getPosition();
		viewDirFromPlayer = testScene.getScenegraph()->searchNode("Player")->getPlayer()->getViewDirection();
		//ToDo calculate Normal funktioniert evtl falsch
		normalFromTerrain = terrain2.calculateNormal(tmpPos.x, tmpPos.z);
		rotateAxis = glm::cross(glm::vec3(viewDirFromPlayer), normalFromTerrain );
	//	lengthFromNormal = glm::length(normalFromTerrain);
	//	lengthFromUp = glm::length(up);
		normalFromTerrain = glm::normalize(normalFromTerrain);
		up = glm::normalize(up);
		phi = glm::dot(up, normalFromTerrain);
		phi = glm::atan(phi) * (180 / glm::pi<float>());
	//	phi = glm::acos(glm::dot(normalFromTerrain, up) / (lengthFromNormal * lengthFromUp));
		//ToDo Rotation ├╝berschreibt die fr├╝here Rotation
		testScene.getScenegraph()->searchNode("Player")->addRotation(phi, rotateAxis);

		antHome.updateAnts();

		//===================================================================//
		//==================Render your Objects==============================//
		//==================================================================//
		//renderer.renderScene(testScene, testWindow);


		fboGBuffer.bind();
		glClearColor(0.5, 0.5, 0.5, 0);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		shaderGBuffer.bind();
		shaderGBuffer.sendMat4("viewMatrix", cam.getViewMatrix());
		shaderGBuffer.sendMat4("projectionMatrix", cam.getProjectionMatrix());

		testScene.render(shaderGBuffer);


		shaderGBuffer.unbind();
		fboGBuffer.unbind();

		//ScreenFillingQuad Render Pass
		shaderSFQ.bind();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		shaderSFQ.sendSampler2D("fboTexture", fboGBuffer.getColorTexture(2));

		screenFillingQuad.renderGeometry();
		shaderSFQ.unbind();

		renderer.renderGUI(*playerGUI.getHUD(), testWindow);
		glfwSwapBuffers(testWindow.getWindow());
		glfwPollEvents();


	}



	glfwDestroyWindow(testWindow.getWindow());
	glfwTerminate();


	return 0;

}
Example #16
0
bool Enemy::update(Game* _game)
{
	if(mHealth <= 0)
	{
		Emitter* newEmitter = new Emitter(sf::Vector2f(mX, mY), sf::Vector2f(.0f, -1.f), EMITTERTYPE_Directional, false);
		newEmitter->parseParticleFile("Resources/Particles/plus10.particle");
		_game->addEmitter(newEmitter);
		
		Random* random = Random::get_singleton();
		int rand = (int)random->rand_range(1, 250);
		Timer* t = NULL;
		for(auto& i: _game->getObjects())
			if(i->getUniqueType() == "spawnTimer")
				t = static_cast<Timer*>(i);

		if(rand >= 190 && rand <= 219)
		{
			WeaponPickup* pickup = new WeaponPickup(14, mX, mY, mReloadVisual);
			_game->pushObject(pickup);
		}
		else if(rand >= 220 && rand <= 240)
		{
			WeaponPickup* pickup = new WeaponPickup(15, mX, mY, mReloadVisual);
			_game->pushObject(pickup);
		}
		else if(rand >= 241 && t->getRound() > 40)
		{
			WeaponPickup* pickup = new WeaponPickup(13, mX, mY, mReloadVisual);
			_game->pushObject(pickup);
		}

		HealthPickup* pickup = new HealthPickup(19, mX, mY);
		_game->pushObject(pickup);

		int coinRand = (int)random->rand_range(1, 4);
		for(int i = 0; i < coinRand; i++)
		{
			CoinPickup* pickup = new CoinPickup(20, mX, mY + (45 * i));
			_game->pushObject(pickup);
		}

		// Score
		Player* player = static_cast<Player*>(_game->getPlayer());
		sf::Vector2f playerPositon = _game->getPlayer()->getPosition();
		double distance = sqrt((playerPositon.x - mX) * (playerPositon.x - mX) + (playerPositon.y - mY) * (playerPositon.y - mY));

		float scoreRand = random->rand_range(0.3f, 0.7f);
		player->addScore((int)(1000 - distance * scoreRand), _game);

		// Destroy
		destroy();
	}

	if(mAIState == AISTATE_Pursue)
	{
		sf::Vector2f direction;
		direction.x = _game->getPlayer()->getPosition().x - mX /** 0.8f*/;
		direction.y = _game->getPlayer()->getPosition().y - mY /** 0.8f*/;

		float normal = sqrt(direction.x * direction.x + direction.y * direction.y);
		direction.x /= normal;
		direction.y /= normal;

		mVelocityX = (direction.x * _game->getDelta() * 10.f) * .6f;
		mVelocityY = (direction.y * _game->getDelta() * 10.f) * .6f;

		Random* random = Random::get_singleton();
		mVelocityX += random->rand_range(-.5f, .5f);
		mVelocityY += random->rand_range(-.5f, .5f);

		sf::Vector2f distance;
		distance.x = _game->getPlayer()->getPosition().x - mX;
		distance.y = _game->getPlayer()->getPosition().y - mY;

		if(abs(distance.x) < 25.f && abs(distance.y) < 25.f)
			mAIState = AISTATE_Attack;
	}
	else if(mAIState == AISTATE_Attack)
	{
		mVelocityX = 0.f;
		mVelocityY = 0.f;

		sf::Vector2f distance;
		Player* player = static_cast<Player*>(_game->getPlayer());
		distance.x = (player->getPosition().x + player->getAABB().width) - (mX + mAABB.width);
		distance.y = (player->getPosition().y + player->getAABB().height) - (mY + mAABB.height);
		player->damage(1);

		if(abs(distance.x) > 25.f && abs(distance.y) > 25.f)
			mAIState = AISTATE_Pursue;
	}

	Animation::update(_game);
	addPosition(mVelocityX * (_game->getDelta() * 1000.f), mVelocityY * (_game->getDelta() * 1000.f));
	Object::update(_game);
	return true;
}
void Game::update(float delta)
{
	for (size_t i = 0; i < delays.size(); i++)
	{
		delays[i].time -= delta;

		if (!delays[i].fired && delays[i].time <= 0.0f)
		{
			delays[i].fired = true;
			delays[i].func();

			delays[i] = delays[delays.size() - 1];
			delays.pop_back();
			i--;
		}
	}

	highestBlock = 0.0f;
	shakeIntensity = glm::max(0.0f, shakeIntensity - delta * 1.5f);

	for (int i = 0; i < 2; i++)
		bound[i] = glm::clamp(bound[i] - delta * 2.0f, 0.0f, 1.0f);

	for (auto it = powerups.begin(); it != powerups.end(); ++it)
	{
		if (it->update(delta))
		{
			*it = powerups.back();
			it--;
			powerups.pop_back();
			continue;
		}
	}

	for (auto it = blocks.begin(); it != blocks.end(); ++it)
	{
		if (!it->alive)
		{
			*it = blocks.back();
			it--;
			blocks.pop_back();
			continue;
		}

		it->update(delta);
	}

	if (glfwGetTime() >= nextBlockSpawn)
	{
		scheduleNextBlockSpawn();

		std::uniform_int_distribution<> dist(4, 8);
		std::uniform_real_distribution<> dist2(0.0f, 3150.0f);

		int count = dist(random);

		for (int i = 0; i < count; i++)
		{
			float x = 50 * glm::round((float)dist2(random) / 50);
			blocks.push_back(Block(this, glm::vec2(x, highestBlock -1050.0f)));
		}
	}

	if (glfwGetTime() >= nextPowerupSpawn)
	{
		scheduleNextPowerupSpawn();
		powerups.push_back(Powerup(this));
	}

	glm::vec2 pos_min, pos_max;
	bool pos_one = false;

	//for (auto it = players.begin(); it != players.end(); ++it)
	for (size_t i = 0; i < players.size(); i++)
	{
		Player *it = &*players[i];

		if (!it->dead)
		{
			glm::vec2 pos = it->getPosition();

			if (!pos_one)
			{
				pos_min = pos;
				pos_max = pos;
				pos_one = true;
			}
			else
			{
				pos_min = glm::min(pos_min, pos);
				pos_max = glm::max(pos_max, pos);
			}

			it->update(delta);
		}
		else if (glfwGetTime() - it->deathTime >= 3.0f)
			it->resetFinish();
	}

	for (auto it = particles.begin(); it != particles.end(); ++it)
	{
		if (it->duration <= 0.0f)
		{
			*it = particles.back();
			it--;
			particles.pop_back();
			continue;
		}

		it->update(delta);
	}

	if (pos_one)
	{
		int width, height;
		glfwGetWindowSize(window, &width, &height);

		//camera.pos_dest.x = (pos_min.x + pos_max.x) / 2.0f - width / 2.0f + 25.0f;
		//camera.pos_dest.y = (pos_min.y + pos_max.y) / 2.0f - height / 2.0f + 25.0f;
		camera.pos_dest.x = (pos_min.x + pos_max.x) / 2.0f + 25.0f;
		camera.pos_dest.y = (pos_min.y + pos_max.y) / 2.0f + 25.0f;
		//camera.pos_dest.y = 1000.0f - height;
		camera.scale_dest = glm::min(1.0f, (width - 200) / glm::abs(pos_min.x - pos_max.x));

		camera.pos -= (camera.pos - camera.pos_dest) * delta * camera.speed;
		camera.scale -= (camera.scale - camera.scale_dest) * delta * camera.speed;
	}

	fmod->update();
}
int _tmain(int argc, _TCHAR* argv[])
{		
	int result = EXIT_SUCCESS;
	DOMConfigurator::configure("Log4cxxConfig.xml");
	string input;
	int playerPort;
	int destPort;
	int player = 0;
	Player playerA = Player();
	Player playerB = Player();

	char W[200]  = "W";
	char A[200]  = "A";
	char S[200]  = "S";
	char D[200]  = "D";

	network.initialise();
	//host or client for window title and for log.
	char* applicationName;

	applicationName = "Tag";

    SMALL_RECT windowSize = {0, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2};
    SetConsoleWindowInfo(hConsole, TRUE, &windowSize);
		
    
	bool gameOver = false;
	Vector2f mapBoundries = Vector2f(SCREEN_WIDTH, SCREEN_HEIGHT);
	
	
	
	RenderWindow renderWindow(VideoMode(SCREEN_WIDTH/2, SCREEN_HEIGHT, 32), applicationName);
	renderWindow.SetFramerateLimit(30);
	renderWindow.SetSize(SCREEN_WIDTH/2, SCREEN_HEIGHT);
	Shape player1circle = sf::Shape::Circle(Vector2f(0,0), 20.0f, sf::Color::Blue);
	Shape player2circle = sf::Shape::Circle(Vector2f(0,0), 20.0f, sf::Color::Red);



	cout << "Are you player A or B?";
	cin >> input;
	
	if (input == "a" || input == "A")
	{	

		player = 1;
		playerPort = 28000;
		destPort = 28001;
		playerA.setPort(playerPort);
		playerB.setPort(destPort);
		network.setupUDP(28000,_ip);
		LOG4CXX_INFO(loggerMyMain, "Player Binds A" );

	}

	else if (input == "b" || input == "B")
	{	
		
		player = 2;
		playerPort = 28001;
		destPort = 28000;
		playerA.setPort(destPort);
		playerB.setPort(playerPort);
		network.setupUDP(28001,_ip);
		LOG4CXX_INFO(loggerMyMain, "Player Binds B" );

	}

	playerA.setPosition(sf::Vector2f(80,80));
	playerB.setPosition(sf::Vector2f(120,120));

	player1circle.SetPosition(playerA.getPosition());
	player2circle.SetPosition(playerB.getPosition());

	try
	{

		//While the connection is not closed remotely
		while(renderWindow.IsOpened() && !gameOver)
		{		
		
			Event sfmlEvent;
		
			while (renderWindow.PollEvent(sfmlEvent))
			{
				// Close window : exit
				if (sfmlEvent.Type == Event::Closed)
				{
					renderWindow.Close();
				}
				else if (sfmlEvent.Type == Event::KeyPressed)
				{

				      if (sf::Keyboard::IsKeyPressed(sf::Keyboard::W))
					  {			
						if(player == 2)
						{
							playerA.update(1);
						}

						else if(player == 1)
						{
							playerB.update(1);
						}
						network.sendData("127.0.0.1",destPort, "W");
					  }

					  if (sf::Keyboard::IsKeyPressed(sf::Keyboard::A))
					  {			
						if(player == 2)
						{
							playerA.update(2);
						}

						else if(player == 1)
						{
							playerB.update(2);
						}
						network.sendData("127.0.0.1",destPort, "A");
					  }

					  if (sf::Keyboard::IsKeyPressed(sf::Keyboard::S))
					  {			
						if(player == 2)
						{
							playerA.update(3);
						}

						else if(player == 1)
						{
							playerB.update(3);
						}
						network.sendData("127.0.0.1",destPort, "S");
					  }

					  if (sf::Keyboard::IsKeyPressed(sf::Keyboard::D))
					  {			
						  if(player == 2)
						{
							playerA.update(4);
						}

						else if(player == 1)
						{
							playerB.update(4);
						}
						  network.sendData("127.0.0.1",destPort, "D");
					  }


					

					//cout << "Message recieved from, port = " << network.getSenderPort() << ", ip = "<< network.getSenderIP() << endl; 
					//messageRecieved = false;
					}

					if(network.receiveData(message))
					{
					LOG4CXX_INFO(loggerMyMain, message );
					
					if(strcmp(message , W) == 0)
					{		
						LOG4CXX_INFO(loggerMyMain, "Message Recieved" );
						LOG4CXX_INFO(loggerMyMain, message );
							if(player == 1)
							{
								playerA.update(1);
							}

							else if(player == 2)
							{
								playerB.update(1);
							}
					}

					if(strcmp(message , A) == 0)
					{
						LOG4CXX_INFO(loggerMyMain, "Message Recieved" );
						LOG4CXX_INFO(loggerMyMain, message );
							if(player == 1)
							{
								playerA.update(2);
							}

							else if(player == 2)
							{
								playerB.update(2);
							}				

					}

					if(strcmp(message , S) == 0)
					{
						LOG4CXX_INFO(loggerMyMain, "Message Recieved" );
						LOG4CXX_INFO(loggerMyMain, message );
							if(player == 1)
							{
								playerA.update(3);
							}

							else if(player == 2)
							{
								playerB.update(3);
							}
					}

					if(strcmp(message , D) == 0)
					{
						LOG4CXX_INFO(loggerMyMain, "Message Recieved" );
						LOG4CXX_INFO(loggerMyMain, message );
							if(player == 1)
							{
								playerA.update(4);
							}

							else if(player == 2)
							{
								playerB.update(4);
							}

						}


						  
					}
				}

				player1circle.SetPosition(playerA.getPosition());
				player2circle.SetPosition(playerB.getPosition());
			
				renderWindow.Clear();
				renderWindow.Draw(player1circle);
				renderWindow.Draw(player2circle);
				renderWindow.Display();
		}
	
		renderWindow.Close();
	
	

		cout << "Exiting application.\n";
    
	}
    catch(Exception&)
    {
		result = EXIT_FAILURE;
    }	

	
	return result;
}