Exemplo n.º 1
0
DustCloudParticle::DustCloudParticle(unsigned int numParticles, float minSize, float maxSize, float xPos, float yPos)
{
	RenderComponent::RenderComponent();
	//gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderManager* renderMan = RenderManager::getRenderManager();
	ResourceManager* ResMan = ResourceManager::GetResourceManager();
	//RenderResource * originalImage = ;
	//std::function<bool(void)> charge = isCharging;
	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, xPos, yPos);
	objRef->toggleVisible();
	for (unsigned int i = 0; i < numParticles; i++){
		SDLRenderObject * sprite = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, xPos, yPos);
		RenderResource * resource = new RenderResource((RenderResource*)ResMan->findResourcebyID(4001));
		resource->load();
		sprite->setResourceObject(resource);
		sprite->setScale(sprite->calcXScale(minSize + (maxSize-minSize)*(rand()%100)/100));
		std::list<motion> movements;
		movements.push_back(makeMotion(moveLinearXY(sprite, xPos, yPos, xPos+ 40 -(rand() % 80),
													yPos + 40 - (rand() % 80)),0, 1, ease_QuadIn));
		movements.push_back(makeMotion(rotateTransform(sprite, rand() % 360, (rand() % 90) - 45), 0, 1));
		Animation * movement = new Animation((float)(700 - (rand() % 200)), movements);
		particle p;
		p.animations = movement;
		p.sprite = sprite;
		p.timer = (float)progress;
		particles.push_back(p);
	}
}
Exemplo n.º 2
0
WellRenderComponent::WellRenderComponent(GameObject * well, int team)
{
	gameObjectRef = well;
	gameObjectRef->AddComponent(COMPONENT_RENDER, this);

	RenderComponent::RenderComponent();
	SceneManager* sceneMan = SceneManager::GetSceneManager();

	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, 0, 0);
	auto wellObj = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 2110, 0, 0);
	wellObj->setParent(objRef);
//	if (team == TEAM_PURPLE){
	//	wellObj->setRotation(180);
//	}

}
Exemplo n.º 3
0
PlayerRenderComponent::PlayerRenderComponent(GameObject* player, function_t func)
{
	gameObjectRef = player;
	gameObjectRef->AddComponent(COMPONENT_RENDER, this);

	RenderComponent::RenderComponent();
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderManager* renderMan = RenderManager::getRenderManager();
	std::string playerName = NetworkManager::sInstance->getLobbyMap().find(gameObjectRef->ID)->second;

	SDLRenderObject * name = sceneMan->InstantiateBlankObject(sceneMan->findLayer("layer2"), 0, 0, 0, 0);
	int r, g, b;
	if (gameObjectRef->posY < 0){
		r = 200, g=0, b = 200;
	}
	else r = 255, g = 255, b=0;
	name->setResourceObject(renderMan->renderText(playerName.c_str(), r, g, b, 20, "BowlbyOneSC-Regular"));
	//name->setParent(base);
	name->setPos(0, -60);
	allObjs["name"] = name;
	if (allObjs["box"])allObjs["box"]->visible = true;
	

	//pick random egg resource. currently hardcoded to 74
	SDLRenderObject* egg = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 74, 0, 0);
	egg->visible = false;
	egg->setParent(allObjs["base"]);
	allObjs["egg"] = egg;

	//assign animations
	func(&objRef, allObjs, animations);
}
ShrapnelExplosionParticle::ShrapnelExplosionParticle(SDLRenderObject * base, unsigned int numParticles, float x, float y)
{
	RenderComponent::RenderComponent();
	//gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderManager* renderMan = RenderManager::getRenderManager();
	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, x, y, base->getPosZ());
	objRef->toggleVisible();
	baseImage = base->renderResource;
	SDL_Rect baseRect = base->getRenderRect();
	unsigned int scale = 2;
	float size = (float)(baseRect.w/scale);
	float centerX = x;
	float centerY = y;
	for (unsigned int i = 0; i < numParticles; i++){
		SDLRenderObject * sprite = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, centerX, centerY);
		//play->setResourceObject(renderMan->renderText("Timer", 255, 0, 255, 50, "BowlbyOneSC-Regular"));
		sprite->setResourceObject(baseImage);
		int xPos = (baseRect.w - int(size) > 0) ? rand() % (baseRect.w - int(size)) : 0;
		int yPos = (baseRect.h - int(size) > 0) ? rand() % (baseRect.h - int(size)) : 0;
		SDL_Rect rect = { xPos, yPos , (int)size, (int)size };
		sprite->setScaleX(base->getScaleX());
		sprite->setScaleY(base->getScaleY());
		sprite->setRenderRect(rect);
		float u = (float)((rand() % 360) / 360.0);
		float v = (float)((rand() % 360) / 360.0);
		float angle1 = (float)(3.14 * 2 * u);
		float angle2 = acos(2 * v - 1);

		std::list<motion> movements;
		movements.push_back(makeMotion(moveLinearXY(sprite, centerX, centerY, centerX + sin(angle1)*cos(angle2) * 300, centerY + sin(angle1)* sin(angle2) * 300), 0, 1, ease_QuadOut));
		movements.push_back(makeMotion(moveLinearZ(sprite, 0, cos(angle1) * 10), 0, 1, ease_QuadOut));
		movements.push_back(makeMotion(rotateTransform(sprite, rand() % 360, (rand() % 90) - 45), 0, 1));
		Animation * movement = new Animation((float)(1000.0f - (rand() % 200)), movements);
		//int maxtime = 100000; //in seconds
		//std:list<motion> motions;
		particle p;
		p.animations = movement;
		p.sprite = sprite;
		p.timer = 0;
		particles.push_back(p);
	}
}
PowerShieldRenderComponent::PowerShieldRenderComponent(GameObject* shield)
{
	/// Set GameObject to "shield" argument
	gameObjectRef = shield;
	gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderComponent::RenderComponent();

	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, 0, 0);
	//base->toggleIfRenderImage();
	SDLRenderObject * shield1 = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 4003, 0 , 0);

	allObjs["base"] = objRef;
	allObjs["shield"] = shield1;
	allObjs["shield"]->visible = true;
	allObjs["shield"]->setScale(0.4f);

	shield1->setParent(objRef);

    shield1->setAnchor(0.5f, 1.0f);

}
Exemplo n.º 6
0
FeatherZoomParticle::FeatherZoomParticle(GameObject * source, unsigned int numParticles, unsigned int frequency)
{
	RenderComponent::RenderComponent();
	//gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderManager* renderMan = RenderManager::getRenderManager();
	parentObject = source;
	numberOfParticles = numParticles;
	frequencyOfParticles = frequency;
	alive = true;
	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, parentObject->posX, parentObject->posY);
	objRef->toggleVisible();
}
Exemplo n.º 7
0
EffectRenderComponent::EffectRenderComponent(GameObject* effect, int effectType){
	gameObjectRef = effect;
	gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	//Can put in an enum passed in and switch on the enum here to instantiate different resource ID's
	switch (effectType)
	{
	case EFFECT_EXPLOSION:
		objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 4001, gameObjectRef->posX, gameObjectRef->posY);
		allObjs["base"] = objRef;
		//Start timer with DestroyEffect call here
		//Still need to use Timing.cpp to wait for 1 second then destroy object
		Timing::sInstance.StartExplosionTimer();
		explosionTriggered = true;
		break;
	case EFFECT_PLACEHOLDER:
		//throwaway enum, can delete once we have different effects to put in
		break;
	default:
		break;
	}
	

}
Exemplo n.º 8
0
void ChickenClassComponent::animation(SDLRenderObject** objRef, map_obj& allObjs, map_anim& animations)
{
    SceneManager* sceneMan = SceneManager::GetSceneManager();
    RenderManager* renderMan = RenderManager::getRenderManager();
    SDLRenderObject * base = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 0, 0, 0);
    base->toggleIfRenderImage();
    SDLRenderObject * armL = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 100103, 0, 0);
    SDLRenderObject * legL = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 100105, 30, 300);
    SDLRenderObject * body = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 100101, 0, -18);
    SDLRenderObject * legR = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 100104, 50, 300);
    SDLRenderObject * armR = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 100102, 0, 0);

    //PlayerPhysicsComponent pos = gameObjectRef->GetComponent(COMPONENT_PHYSICS);


    //objRef->setAnchor(0.5, 0.5);

    armR->setAnchor(174 / double(armR->renderRect.w), 154 / double(armR->renderRect.h));
    armL->setAnchor(178 / double(armL->renderRect.w), 168 / double(armL->renderRect.h));
    legR->setAnchor(128 / double(legR->renderRect.w), 39 / double(legR->renderRect.h));
    legL->setAnchor(253 / double(legL->renderRect.w), 62 / double(legL->renderRect.h));
    //armR->setCurrentFrame(1);
    body->setParent(base);
    armL->setParent(body);
    armR->setParent(body);
    legL->setParent(body);
    legR->setParent(body);

    //body->setScale(0.1);
    //body->calcScale(50,50);
    body->setScale(body->calcXScale(50));
    //body->setScale(body->calcXScale(90));

    *objRef = base;
    allObjs["base"] = base;
    allObjs["body"] = body;
    allObjs["legL"] = legL;
    allObjs["legR"] = legR;
    allObjs["armL"] = armL;
    allObjs["armR"] = armR;

    SDLRenderObject * box = sceneMan->InstantiateBlankObject(sceneMan->findLayer("layer2"), 0, 0, 0, 0);
    box->setIfRenderRect(true);
    //box->setParent(base);
    allObjs["box"] = box;
    //SDLRenderObject * name = sceneMan->InstantiateBlankObject(sceneMan->findLayer("layer2"), 0, 0, 0, 0);
    // changing the values in InstantiateBlankObject does not stop the text from being stretched
    // need fixing (to not stretch text to fill box)
    // text, R, G, B, fontsize, fontname

    //std::string playerName = GamerServices::sInstance->GetLocalPlayerName();
    //name->setResourceObject(renderMan->renderText(playerName.c_str(), 200, 0, 200, 20, "BowlbyOneSC-Regular"));
    //name->setParent(base);
    //name->setPos(0, -60);
    //allObjs["name"] = name;

    /////// IDLE ANIMATION
    std::list<motion> motions;
    motions.push_back(makeMotion(keyframeJump(armR, 0), 0.0, 0.0));
    motions.push_back(makeMotion(moveCircArc(armR, 0, 50, 50, 0, 360), 0, 1));
    motions.push_back(makeMotion(moveCircArc(armL, 0, 50, 50, 180, 360), 0, 1));
    motions.push_back(makeMotion(rotateTransform(legR, 0, 0), 0, 0));
    motions.push_back(makeMotion(rotateTransform(legL, 0, 0), 0, 0));
    Animation* idle = new Animation(400, motions);
    animations["idle"] = idle;
    //auto mot = idle.motions.begin();
    //currentAnimation = idle;
    ////// WALKING ANIMATION
    std::list<motion> motions2;
    motions2.push_back(makeMotion(keyframeJump(armR, 0), 0.0, 0.0));
    motions2.push_back(makeMotion(moveCircArc(armR, 0, 50, 50, 0, 360), 0, 1));
    motions2.push_back(makeMotion(moveCircArc(armL, 0, 50, 50, 180, 360), 0, 1));
    motions2.push_back(makeMotion(rotateTransform(legR, -60, 120), 0, 0.5, ease_QuadInOut));
    motions2.push_back(makeMotion(rotateTransform(legR, 60, -120), 0.5, 0.5, ease_QuadInOut));
    motions2.push_back(makeMotion(rotateTransform(legL, 60, -120), 0, 0.5, ease_QuadInOut));
    motions2.push_back(makeMotion(rotateTransform(legL, -60, 120), 0.5, 0.5, ease_QuadInOut));
    //motions2.push_back(makeMotion(rotateTransform(legR, -30, 60), 0.5, 0.5, ease_QuadIn));
    animations["walk"] = new Animation(400, motions2);

    ////// THROW ANIMATION
    std::list<motion> motions3;
    motions3.push_back(makeMotion(keyframeJump(armR, 1), 0.0, 0.0));
    motions3.push_back(makeMotion(rotateTransform(armR, -30, 0), 0.0, 1.0,ease_QuadOut));
    animations["throw"] = new Animation(100, motions3);
    ////// CHARGE ANIMATION
    std::list<motion> motions4;
    motions4.push_back(makeMotion(rotateTransform(armR,-20,0), 0.0, 0.0));
    animations["charge"] = new Animation(100, motions4);
}
Exemplo n.º 9
0
void Lobby::createPlayerCount(){
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	playersInLobby = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, 5, 0, true);
	playersInLobby->setPos(0, 0);
}
Exemplo n.º 10
0
BackgroundProps::BackgroundProps()
{
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, 0, 0);
	//Planets
	allObjs["planet1"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2105, 0.0f, -200.0f, 400.0f);
	allObjs["planet1"]->setScale(20);
	allObjs["planet2"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2104, 80000.0f, -20000.0f, 4000.0f);
	allObjs["planet2"]->setScale(200);
	allObjs["planet3"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2103, -80000.0f, 40000.0f, 4000.0f);
	allObjs["planet3"]->setScale(200);

	//Clouds
	allObjs["cloudB1"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2106, 0.0f, 500.0f, 4000.1f);
	allObjs["cloudB1"]->setScale(170);
	allObjs["cloudT1"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2106, 0.0f, -500.0f, 4000.1f);
	allObjs["cloudT1"]->setScale(170);
	allObjs["cloudT1"]->setRotation(180);
	allObjs["cloudB2"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2107, 0.0f, 4800.0f, 300.0f);
	allObjs["cloudB2"]->setScale(20);
	allObjs["cloudT2"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2107, 0.0f, -4800.0f, 300.0f);
	allObjs["cloudT2"]->setScale(20);
	allObjs["cloudT2"]->setRotation(180);

	//Boids
	allObjs["boidB1"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2108, 3250.0f, 2200.0f, 99.9f);
	allObjs["boidB1"]->setScale(1);
	allObjs["boidB2"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2109, 1200.0f, 2000.0f, 99.9f);
	allObjs["boidB2"]->setScale(1);
	allObjs["boidB2"]->setFlippedH(true);
	allObjs["boidB3"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2108, -1500.0f, 2100.0f, 99.9f);
	allObjs["boidB3"]->setScale(1);
	allObjs["boidB3"]->setFlippedH(true);
	allObjs["boidB4"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2109, -3400.0f, 2200.0f, 99.9f);
	allObjs["boidB4"]->setScale(1);

	allObjs["boidT1"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2108, -3250.0f, -2200.0f, 99.9f);
	allObjs["boidT1"]->setScale(1);
	allObjs["boidT1"]->setFlippedV(true);
	allObjs["boidT2"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2109, -1200.0f, -2000.0f, 99.9f);
	allObjs["boidT2"]->setScale(1);
	allObjs["boidT2"]->setFlippedH(true);
	allObjs["boidT2"]->setFlippedV(true);
	allObjs["boidT3"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2108, 1500.0f, -2100.0f, 99.9f);
	allObjs["boidT3"]->setScale(1);
	allObjs["boidT3"]->setFlippedH(true);
	allObjs["boidT3"]->setFlippedV(true);
	allObjs["boidT4"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2109, 3400.0f, -2200.0f, 99.9f);
	allObjs["boidT4"]->setScale(1);
	allObjs["boidT4"]->setFlippedV(true);
	//cloudT2->setRotation(180);

	//Protein Mountain


	//Beaches

	allObjs["beachB"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2101, 0.0f, 2200.0f, 100.0f);
	allObjs["beachT"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2101, 0.0f, -2200.0f, 100.0f);
	allObjs["surfB"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2102, 0.0f, 0.0f, 0.0f);
	allObjs["surfT"] = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 2102, 0.0f, 0.0f, 0.0f);
	allObjs["beachB"]->setScale(6);
	allObjs["beachT"]->setScale(6);
	allObjs["surfB"]->setParent(allObjs["beachB"]);
	allObjs["surfT"]->setParent(allObjs["beachT"]);
	allObjs["beachT"]->setRotation(180);
	std::list<motion> surfMotions;
	surfMotions.push_back(makeMotion(transformFlipH(allObjs["surfB"], false), 0.0, 0.0));
	surfMotions.push_back(makeMotion(transformFlipH(allObjs["surfT"], false), 0.0, 0.0));
	surfMotions.push_back(makeMotion(moveLinearY(allObjs["surfB"], -21, -6), 0, 0.5));
	surfMotions.push_back(makeMotion(moveLinearY(allObjs["surfT"], -21, -6), 0, 0.5));
	surfMotions.push_back(makeMotion(transformFlipH(allObjs["surfB"], true), 0.5, 0.5));
	surfMotions.push_back(makeMotion(transformFlipH(allObjs["surfT"], true), 0.5, 0.5));
	surfMotions.push_back(makeMotion(moveLinearY(allObjs["surfB"], -21, -6), 0.5, 1.0));
	surfMotions.push_back(makeMotion(moveLinearY(allObjs["surfT"], -21, -6), 0.5, 1.0));
	animations["surf"] = new Animation(1000, surfMotions);
	setAnimation("surf");
}
Exemplo n.º 11
0
void UITypeComponent::createUIType(UIType ID){

	SceneManager* sceneMan = SceneManager::GetSceneManager();
	SDLRenderObject *play;

	switch (ID){
	case PLAY_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 19, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case CANCEL_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 22, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case BACK_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 23, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case JOIN_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 24, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case OPTIONS_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 29, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case READY_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 26, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case PLAYER_SLOT:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 28, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case CHICKEN:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), CHICKEN, uiObjectRef->posX, uiObjectRef->posY, true);
		uiObjectRef->setWidthAndHeight(play->getWidth(), play->getHeight());
		objRef = play;
		allObjs.push_back(play);
		break;
	case PEACOCK:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), PEACOCK, uiObjectRef->posX, uiObjectRef->posY, true);
		uiObjectRef->setWidthAndHeight(play->getWidth(), play->getHeight());
		objRef = play;
		allObjs.push_back(play);
		break;
	case FLAMINGO:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), FLAMINGO, uiObjectRef->posX, uiObjectRef->posY, true);
		uiObjectRef->setWidthAndHeight(play->getWidth(), play->getHeight());
		objRef = play;
		allObjs.push_back(play);
		break;
	case QUAIL:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), QUAIL, uiObjectRef->posX, uiObjectRef->posY, true);
		uiObjectRef->setWidthAndHeight(play->getWidth(), play->getHeight());
		objRef = play;
		allObjs.push_back(play);
		break;
	case TURKEY:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), TURKEY, uiObjectRef->posX, uiObjectRef->posY, true);
		uiObjectRef->setWidthAndHeight(play->getWidth(), play->getHeight());
		objRef = play;
		allObjs.push_back(play);
		break;
	case EAGLE:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), EAGLE, uiObjectRef->posX, uiObjectRef->posY, true);		
		uiObjectRef->setWidthAndHeight(play->getWidth(), play->getHeight());
		objRef = play;
		allObjs.push_back(play);
		break;
	case INVITE_BUTTON:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 29, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case TIMER:{
		RenderManager* renderMan = RenderManager::getRenderManager();
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, uiObjectRef->posX, uiObjectRef->posY, true);
		play->setResourceObject(renderMan->renderText("Timer", 247, 92, 15, 50, "BowlbyOneSC-Regular"));

		objRef = play;
		allObjs.push_back(play);
		break;
	}
	case LOBBY_TIMER:{
		RenderManager* renderMan = RenderManager::getRenderManager();

		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, uiObjectRef->posX, uiObjectRef->posY, true);
		play->setResourceObject(renderMan->renderText("", 247, 92,255, 50, "BowlbyOneSC-Regular"));

		objRef = play;
		allObjs.push_back(play);
		break;
	}
	case BIRDSEED_BAR:
		//TODO: these hardcoded positions are to put it a bit away from the borders of the screen.
		//We'll need to store them as variables, since PlayerLogicComponent->update has hardcoded
		//values to match
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1101, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case BIRDSEED_SHELL:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1100, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case CROSSHAIR:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1109, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case MENU_NAME:{
		std::string playerName = GamerServices::sInstance->GetLocalPlayerName();
		RenderManager* renderMan = RenderManager::getRenderManager();
		SDLRenderObject * name = sceneMan->InstantiateBlankObject(sceneMan->findLayer("layer2"), 0, 0, 0, 0);
		int x, y;
		renderMan->getWindowSize(&x, &y);
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, (float)x / 2.0f, (float)y / 2.0f, true);
		play->setResourceObject(renderMan->renderText(playerName.c_str(), 255, 0, 255, 50, "BowlbyOneSC-Regular"));
		break;
	}
	// CHARGE BAR needs to follow player posX/posY at a slight offset
	// using 1102 and 1103 for object IDs
	// position is currently hardcoded, need to move to follow the player sprite location
	case CHARGE_BAR:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1103, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case CHARGE_SHELL:
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1102, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		allObjs.push_back(play);
		break;
	case KILL_NOTIFICATION:{
		play = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, uiObjectRef->posX, uiObjectRef->posY, true);
		objRef = play;
		RenderManager* renderMan = RenderManager::getRenderManager();
		objRef->setResourceObject(renderMan->renderText("", 255, 0, 255, 30, "BowlbyOneSC-Regular"));
		objRef->visible = false;
		allObjs.push_back(play);
	}
	}
}
Exemplo n.º 12
0
EggImplosionParticle::EggImplosionParticle(SDLRenderObject * base, unsigned int divisions, float x, float y)
{
	RenderComponent::RenderComponent();
	//gameObjectRef->AddComponent(COMPONENT_RENDER, this);
	SceneManager* sceneMan = SceneManager::GetSceneManager();
	RenderManager* renderMan = RenderManager::getRenderManager();
	ResourceManager* ResMan = ResourceManager::GetResourceManager();
	objRef = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), -1, x, y, base->getPosZ());
	objRef->toggleVisible();
	//baseImage = base->renderResource;
	//RenderResource * baseImage = (RenderResource*)ResMan->findResourcebyID(74);
	//SDL_Rect baseRect = objRef->getRenderRect();
	//unsigned int scale = 2;
	//float size = baseRect.w / scale;
	float centerX = base->getPosX();
	float centerY = base->getPosY();
	//for (int x = 1; x < float(divisions+1)*2.0; x+=2){ 
	//	for (int y  = 1; y < float(divisions+1)*2.0; y+=2){
	for (unsigned x = 0; x <= divisions; x++){ 
		for (unsigned y = 0; y <= divisions; y++){
			SDLRenderObject * sprite = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 74, centerX, centerY);
			sprite->setScale(2);
			float yStart = (float)sprite->getWidth() *((x*2+1) / (float(divisions + 1)*2.0f) - sprite->getAnchorX());
			float xStart = (float)sprite->getHeight() *((y*2+1) / (float(divisions + 1)*2.0f) - sprite->getAnchorY());
			sprite->flipV = true;
			sprite->setPos(centerX, centerY);
			//play->setResourceObject(renderMan->renderText("Timer", 255, 0, 255, 50, "BowlbyOneSC-Regular"));
			sprite->setResourceObject(baseImage);
			SDL_Rect baseRect = sprite->getRenderRect(); 
			/*int xPos = (baseRect.w - int(baseRect.w / (divisions + 1.0)) > 0) ?
						rand() % (baseRect.w - int(baseRect.w / (divisions + 1.0))) : 0;
			int yPos = (baseRect.h - int(baseRect.h / (divisions + 1.0)) > 0) ?
						rand() % (baseRect.h - int(baseRect.h / (divisions + 1.0))) : 0;*/
			int xPos = x * int(baseRect.h / (divisions + 1.0));
			int yPos = y * int(baseRect.h / (divisions + 1.0));
			SDL_Rect rect = { xPos, yPos, (int)round(baseRect.w / (divisions + 1.0)), (int)round(baseRect.h / (divisions + 1.0)) };
			//sprite->setScaleX(base->getScaleX());
			sprite->setRenderRect(rect);
			float u = (float)((rand() % 360) / 360.0f);
			float v = (float)((rand() % 360) / 360.0f);
			float angle1 = 3.14f * 2.0f * u;
			float angle2 = acos(2 * v - 1);

			std::list<motion> movements;
			movements.push_back(makeMotion(moveLinearXY(sprite, centerX + sin(angle1)*cos(angle2) * 300,
																centerY + sin(angle1)* sin(angle2) * 300,
																xStart + centerX, yStart+ centerY), 0, 1, ease_QuadOut));
			movements.push_back(makeMotion(moveLinearZ(sprite, cos(angle1) * 10, 0), 0, 1, ease_QuadOut));
			float spinAngle = (float)(rand() % 360);
			//movements.push_back(makeMotion(rotateTransform(sprite, rand() % 360, (rand() % 90) - 45), 0, 1));
			movements.push_back(makeMotion(rotateTransform(sprite, spinAngle, -spinAngle+90), 0, 1,ease_QuadOut));
			Animation * movement = new Animation(1000, movements);
			//int maxtime = 100000; //in seconds
			//std:list<motion> motions;
			particle p;
			p.animations = movement;
			p.sprite = sprite;
			p.timer = 0;
			particles.push_back(p);
		}
	}
}
Exemplo n.º 13
0
void FeatherZoomParticle::Update(){
	if (!parentObject || !(parentObject->isAlive)){
		alive = false;
	}
	unsigned int currenttime = clock();
	unsigned int oldTime = progress;
	progress += currenttime - lasttime;
	if (alive && ((currenttime - lasttime) > frequencyOfParticles || oldTime%frequencyOfParticles > progress%frequencyOfParticles)){
		SceneManager* sceneMan = SceneManager::GetSceneManager();
		RenderManager* renderMan = RenderManager::getRenderManager();
		//SDL_Rect baseRect = parent->getRenderRect();
		//unsigned int scale = 2;
		//float size = baseRect.w / scale;
		float centerX = parentObject->posX;
		float centerY = parentObject->posY;
		for (unsigned int i = 0; i < numberOfParticles; i++){
			SDLRenderObject * sprite = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 4002, centerX, centerY,0.1f);
			//play->setResourceObject(renderMan->renderText("Timer", 255, 0, 255, 50, "BowlbyOneSC-Regular"));
			//sprite->setScaleX(base->getScaleX());
			//sprite->setScaleY(base->getScaleY());
			//sprite->setRenderRect(rect);
			float angle1 = (30 - (rand() % 60)) + parentObject->rotation;
			sprite->setRotation(angle1);
			std::list<motion> movements;
			movements.push_back(makeMotion(resizeSquareTransform(sprite, 0.01f,0.5f), 0.0f, 0.5f, ease_QuadOut));
			movements.push_back(makeMotion(resizeSquareTransform(sprite, 0.5f, 0.01f), 0.5f, 1.0f, ease_QuadIn));
			movements.push_back(makeMotion(keyframeAnimate(sprite,0,3), 0.0, 1.0, ease_QuadIn));
			//movements.push_back(makeMotion(moveLinearXY(sprite, centerX, centerY, centerX + rand() % 20 - 40, centerY +rand() % 20 - 40), 0, 1, ease_QuadOut));
			//movements.push_back(makeMotion(moveLinearZ(sprite, 0, cos(angle1) * 10), 0, 1, ease_QuadOut));
			//movements.push_back(makeMotion(rotateTransform(sprite, rand() % 360, (rand() % 90) - 45), 0, 1));
			Animation * movement = new Animation((float)(500 - (rand() % 100)), movements);
			//int maxtime = 100000; //in seconds
			//std:list<motion> motions;
			particle p;
			p.animations = movement;
			p.sprite = sprite;
			p.timer = (float)progress;
			particles.push_back(p);
		}
	}
	if (particles.empty() && !alive){
		//delete self and remove GameObject from list of objects
		gameObjectRef->isAlive = false;
	}
	for (auto iter = particles.begin(); iter != particles.end();){
		float curr = iter->animations->lengthConversion((int)(progress-iter->timer));
		//if (curr >= 1.0) iter->sprite->setIfRenderImage(false);
		if (curr >= 1.0){
			//iter->sprite->setIfRenderImage(false);
			delete iter->animations;
			SceneManager* sceneMan = SceneManager::GetSceneManager();
			sceneMan->RemoveObject(iter->sprite);
			auto toErase = iter;
			iter++;
			particles.erase(toErase);
		}
		else{
			iter->animations->animate(curr);
			iter++;
		}
	}
	lasttime = currenttime;
}
Exemplo n.º 14
0
int GameSession::Run(){

	// temp
	int numLobbyPlayer = 0;
	int numPlayers = 1;
	//


	/// MANAGERS

	LogManager* log = LogManager::GetLogManager();
	InputManager* input = InputManager::getInstance();
	AudioManager* audioMan = AudioManager::getAudioInstance();
	RenderManager* renderMan = RenderManager::getRenderManager();
	ResourceManager* resourceMan = ResourceManager::GetResourceManager();
	SceneManager* sceneMan = SceneManager::GetSceneManager();

	input->update();


	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////

	///  SYSTEMS

	SystemNetworkUpdater sysNetwork;
	SystemRenderUpdater sysRenderer;
	SystemInputUpdater sysInput;
	SystemLogicUpdater sysLogic;
	SystemPhysicsUpdater sysPhysics;
	SystemClassUpdater sysClass;
	SystemUIUpdater sysUI;

	/// ENTITIES
	PlayerObjectFactory pFactory;
	MinionObjectFactory mFactory;
	FeatherObjectFactory fFactory;
	PlatformObjectFactory plFactory;
	MidPlatObjectFactory mpFactory;

	numPlayers = NetworkManager::sInstance->GetPlayerCount();
	
	//std::cout << NetworkManager::sInstance->GetLobbyId() << std::endl;
	/*for (const auto& iter : NetworkManager::sInstance->lobbyInfoMap){
		std::cout << iter.first << std::endl;
		std::cout << "\tClass:" << iter.second.classType << std::endl;
	}*/

	GameObject * player = NULL;
	Stats stats;
	/// try to join a game and give each user a unique character in the game
	unordered_map< uint64_t, PlayerInfo > lobby = NetworkManager::sInstance->getLobbyInfoMap();
	Stats::resetStats();
	int i = 0;
	bool local = true;
	for (auto &iter : lobby){
		int classType = iter.second.classType;
		std::cout << "classType: " << classType << std::endl;
		if (iter.first == NetworkManager::sInstance->GetMyPlayerId()){
			player = GameObjects.AddObject(pFactory.Spawn(iter.first, (classType % 50) + 1, (i % 2) + 1, local));
			Stats::setLocalTeam((i % 2) + 1);
			Stats::addPlayer(iter.first, (i % 2) + 1);
		}
		else{
			GameObjects.AddObject(pFactory.Spawn(iter.first, (classType % 50) + 1, (i % 2) + 1, !local));
			Stats::addPlayer(iter.first, (i % 2) + 1);
		}
		++i;
	}



	/////////////////////////////////////////////////////
	/*              * * * GAME LOOP * * *              */
	/////////////////////////////////////////////////////


	bool gameloop = true;
	int var = 0;
	renderMan->zoom = 0.5;

	float size = 6;
	float ratio = 0.7f;
	int armswing = (int)size;
	int moveSpd = 1;
	int pressed = 0;
	int pressedTime = 3;
	int rotation = 0;
	audioMan->playByName("bgmBAAGameplay.ogg");
	bool gameEndMusic = false;
	int mousecounter = 5;
	renderMan->zoom = 0.6f;
	
	SystemUIObjectQueue queue;

	//World Loading
	GameSession::LoadWorld();
	GameSession::LoadPlayers();
	GameSession::LoadHUD(player, queue);

	///*auto spawning minion variables
	int minionCounter = 10000;

	//crosshair variables
	SDLRenderObject * crosshair = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1109, -1000, -1000, -0.05f);
	SDLRenderObject * crosshairCharging = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 1111, -1000, -1000, -0.05f);
	crosshairCharging->visible = false;
	PlayerLogicComponent* playerLogic = dynamic_cast<PlayerLogicComponent*>(player->GetComponent(COMPONENT_LOGIC));
	PlayerRenderComponent* playerRend = dynamic_cast<PlayerRenderComponent*>(player->GetComponent(COMPONENT_RENDER));

	//midway fountain
	/*
	SDLRenderObject * fount = sceneMan->InstantiateObject(sceneMan->findLayer("layer2"), 101004, 40, 150, 0.005f);
	fount->setScale(0.5f);
	list<motion> motions;
	motions.push_back(makeMotion(keyframeAnimate(fount, 0, 15), 0, 1));
	Animation * runWater = new Animation(100, motions);
	int aniCounter = 0;
	*/
	LoadBackgroundProps();

	int aniCounter = 0;


	bool firstTime = true;
	Timing::sInstance.SetCountdownStart();
	NetworkManager::sInstance->SetState(NetworkManager::NMS_Playing);
	std::cout << NetworkManager::sInstance->GetState() << std::endl;


	clock_t current_ticks, delta_ticks;
	clock_t fps = 0;
	string fpscounter = "";

	SDLRenderObject * fpsHUD = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, 5, 0, true);
	fpsHUD->setResourceObject(renderMan->renderText(fpscounter.c_str(), 255, 0, 0, 20, "VT323-Regular"));
	fpsHUD->setPos(0, 0);
	SDLRenderObject * leftbaseHUDicon = nullptr;
	SDLRenderObject * rightbaseHUDicon = nullptr;

	if (player->team == TEAM_PURPLE){
		leftbaseHUDicon = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 7006, 0, 0, true);
		leftbaseHUDicon->flipH = true;
		rightbaseHUDicon = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 7005, 0, 0, true);
		rightbaseHUDicon->flipH = true;
	}
	else{

		leftbaseHUDicon = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 7005, 0, 0, true);
		rightbaseHUDicon = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), 7006, 0, 0, true);
	}

	leftbaseHUDicon->setPos(-150, 600);

	string leftBaseHealth = "";
	SDLRenderObject * leftbaseHUD = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, 5, 0, true);
	leftbaseHUD->setResourceObject(renderMan->renderText(leftBaseHealth.c_str(), 255, 0, 0, 60, "VT323-Regular"));
	leftbaseHUD->setPos(15, 650);



	rightbaseHUDicon->setPos(1214, 600);

	string rightBaseHealth = "";
	SDLRenderObject * rightbaseHUD = sceneMan->InstantiateObject(sceneMan->findLayer("layer1"), -1, 5, 0, true);
	rightbaseHUD->setResourceObject(renderMan->renderText(rightBaseHealth.c_str(), 255, 0, 0, 60, "VT323-Regular"));
	rightbaseHUD->setPos(1281, 650);


	

	renderMan->toggleCursor(0);

	/////////////Flip screen if needed/////////////////

	if (player->team == TEAM_PURPLE){
		std::cout << "flip the screen" << std::endl;
		renderMan->flippedScreen = true;
	}
	//////////////////////////////////////////////////

	bool gameEnd = false;
	inGameStatsRenderComponent inGameStats;

	while (gameloop) {
		current_ticks = clock();


		if (input->isKeyDown(KEY_TAB)){
			inGameStats.updateText();
			inGameStats.toggleOn(true);
		}
		else{
			inGameStats.toggleOn(false);
		}

		//std::cout << NetworkManager::sInstance->GetState() << std::endl;
		
	

		/*if (input->isKeyDown(KEY_Q)){
			if (renderMan->cameraPoint.z < -5){
				renderMan->cameraPoint.z += 1;
			}
		}
		if (input->isKeyDown(KEY_W)){
			renderMan->cameraPoint.z -= 1;
		}
		if (input->isKeyDown(KEY_E)){
			renderMan->flippedScreen = !renderMan->flippedScreen;
		}*/

		/*clock_t t;
		t = clock();*/

		

		if (input->isKeyDown(KEY_F)){
			std::cout << "Number of feathers: " << GameObjects.dead_feathers.size() << std::endl;
		}

		if (input->isKeyDown(KEY_M)){
			std::cout << "Number of minions: " << GameObjects.dead_minions.size() << std::endl;
		}

		if (input->isKeyDown(KEY_L)){
			std::cout << "Alive Objects: " << GameObjects.alive_objects.size() << std::endl;
		} 

		if (input->isKeyDown(KEY_Y)) {
			renderMan->ShakeScreen(.2f, .5f);
		}
		
		mousecounter++;
		////////////////////////////////////

		if (numPlayers != 1)  NetworkManager::sInstance->UpdateDelay();

		//CAMERA MOVEMENT - based on player position
		if (!gameEnd){
			if (player){
				//Camera Shake
				if ((!rightBase->isAlive || !leftBase->isAlive) && !endedBaseShake) {
					endedBaseShake = true;
					renderMan->ShakeScreen(1, 1);
				}
				/*int mousePos = input->getMouseX();
				int wid, hei;
				renderMan->getWindowSize(&wid, &hei);
				float xRatio = (mousePos - wid / 2) / float(wid / 2);
				float xPlus = (float)(wid / 4) - 20;
				//std::cout << xRatio << std::endl;
				renderMan->setCameraPoint(player->posX + xRatio*xPlus, 0);*/
				float mouseX, mouseY;
				renderMan->windowCoordToWorldCoord(mouseX, mouseY, input->getMouseX(), input->getMouseY());
				float cameraX = (player->posX + mouseX) / 2;
				//next line makes the camera favor staying closer to the player
				cameraX = (player->posX + cameraX) / 2;
				renderMan->setCameraPoint(cameraX, 0);

			}
		}
		int length = 20;
		float loop = (float)(var % length);

		//crosshair updating
		float crossX, crossY;
		renderMan->windowCoordToWorldCoord(crossX, crossY, input->getMouseX(), input->getMouseY());
		crosshair->posX = crosshairCharging->posX = crossX;
		crosshair->posY = crosshairCharging->posY = crossY;
		float attackCDPercent = Timing::sInstance.GetAttackCooldownRemaining();
		float chargePercent = 1.0f - (playerLogic->currChargePercentage > 0.75f ? 0.75f : playerLogic->currChargePercentage);
		if (chargePercent != 1.0f){ //sets scale during charge
			//crosshair->setScale(chargePercent);
			crosshairCharging->visible = false;
			crosshair->visible = true;
			playerRend->crosshairRef = crosshair;
		}
		else if (chargePercent == 1.0f && Timing::sInstance.AttackCooldownEnded()) {
			crosshairCharging->visible = false;
			crosshair->visible = true;
			crosshair->setScale(1.0f);
			playerRend->crosshairRef = crosshair;
		}
		else {//if(attackCDPercent < 1.0f) { //sets scale during attack cooldown
			crosshairCharging->setScale(attackCDPercent);
			crosshairCharging->visible = true;
			crosshair->visible = false;
			playerRend->crosshairRef = crosshairCharging;
		} 
		

		//physics testing stuff
		PhysicsListener listener;
		GameWorld* gameWorld = GameWorld::getInstance();
		gameWorld->physicsWorld->SetContactListener(&listener);

		gameWorld->update(); //update physics world
		//end physics testing stuff

		sysInput.InputUpdate(GameObjects.alive_objects);
		sysRenderer.RenderUpdate(GameObjects.alive_objects);
		sysLogic.LogicUpdate(GameObjects.alive_objects);
		sysPhysics.PhysicsUpdate(GameObjects.alive_objects);
		sysClass.ClassUpdate(GameObjects.alive_objects);
		sysUI.UIUpdate(queue.alive_objects);

		if (numPlayers != 1) sysNetwork.NetworkUpdate(GameObjects.alive_objects);

		//updates all timers
		Invoke::UpdateTimers();

		if (input->isKeyDown(KEY_ESCAPE))
			gameloop = false;

		//OBJECT POOLING - moves recently dead objects to respective dead pool
		for (unsigned int i = 0; i < GameObjects.alive_objects.size(); i++){
			if (!GameObjects.alive_objects[i]->isAlive){
				//object has died this last gameloop. send it to the object pool
				//std::cout << "ID: " << GameObjects.alive_objects[i]->ID << std::endl;
				if (GameObjects.alive_objects[i]->type == OBJECT_FEATHER){
					GameObjects.dead_feathers.push_back(GameObjects.alive_objects[i]);
				}
				else if (GameObjects.alive_objects[i]->type == OBJECT_MINION){
					GameObjects.dead_minions.push_back(GameObjects.alive_objects[i]);
				}
				else {
					GameObjects.dead_objects.push_back(GameObjects.alive_objects[i]);
				}
				GameObjects.alive_objects.erase(GameObjects.alive_objects.begin() + i);
			}
		}
		
		if (!firstTime) //allows culling to start after all initialization happens
			cullObjects();


		if (NetworkManager::sInstance->IsMasterPeer() && Timing::sInstance.SpawnMinions()){
			GameObjects.AddObject(mFactory.Spawn(minionCounter++, -900, 0, TEAM_YELLOW));
			GameObjects.AddObject(mFactory.Spawn(minionCounter++, 900, 0, TEAM_PURPLE));

		}
		input->update();
		sceneMan->AssembleScene();

		//triggers endgame screen
		if (Timing::sInstance.GetTimeRemainingS() <= 0) {
			/*if (player->team == TEAM_PURPLE){
					std::cout << "flip the screen" << std::endl;
					renderMan->flippedScreen = false;
			}*/
			gameEnd = true;//so the mouse stops registering 
			int myTeam;
			for (unsigned int i = 0; i < players.size(); i++){
				if (GamerServices::sInstance->GetLocalPlayerId() == players[i]->playerId){
					myTeam = players[i]->team;
				}
			}

			std::cout << "END REACHED " << std::endl;
		  //GameEnd end = GameEnd::GameEnd();
		  //end.runGameEnd(myTeam, leftBase, rightBase);
		  gameloop = false;
		}

		if (Timing::sInstance.GetTimeRemainingS() <= 30 && !gameEndMusic){
			gameEndMusic = true;
			audioMan->stopByName("bgmBAAGameplay.ogg");
			audioMan->playByName("bgmBAAGameEnd.ogg");
		}

		firstTime = false;

		delta_ticks = clock() - current_ticks; //the time, in ms, that took to render the scene
		if (delta_ticks > 0)
			fps = CLOCKS_PER_SEC / delta_ticks;
		//std::cout <<" FPS : " << fps << std::endl;
		fpscounter = std::to_string(fps);
		
		//leftBase->health


		//renderMan->renderText(fpscounter.c_str(), 255, 255, 0, 70, "BowlbyOneSC-Regular");
		fpsHUD->setResourceObject(renderMan->renderText(fpscounter.c_str(), 0, 20, 240, 20, "VT323-Regular"));
		inGameStats.Update();
	}
	/////////////////////////////////////////////////////
	/////////////////////////////////////////////////////
	/////////////////////////////////////////////////////
	audioMan->stopByName("bgmBAAGameEnd.ogg");
	std::cout << renderMan << std::endl;
	std::cout << renderMan << std::endl;
	konamiUnlocked = false;
	log->close();

	//delete surf;
	//delete fount;
	//delete runWater;


	GameWorld::getInstance()->~GameWorld();
	return SCENE_GAMEOVER;
}