Beispiel #1
0
BattleScene::BattleScene(){
	TTF_Init();
	type = SceneManager::BATTLE;
	battleMenu = FIGHT;
	fightVal = 0; runVal = 1;
	font = TTF_OpenFont("../Fonts/coolvetica.ttf",40);
	SDL_Color fgColor = {255,255,0};
	SDL_Color bgColor = {255,255,255};
	bgItemMagicMenu = SDL_LoadBMP("../Images/battle/ItemMagicMenu.bmp");
	SDL_SetColorKey(bgItemMagicMenu,SDL_SRCCOLORKEY,SDL_MapRGB(bgItemMagicMenu->format,255,0,255));
	bgBattleMenu = SDL_LoadBMP("../Images/battle/MenuBox.bmp");
	SDL_SetColorKey(bgBattleMenu, SDL_SRCCOLORKEY, SDL_MapRGB(bgBattleMenu->format, 255,0,255));
	textBox = SDL_LoadBMP("../Images/battle/TextBox.bmp");
	SDL_SetColorKey(textBox, SDL_SRCCOLORKEY, SDL_MapRGB(textBox->format, 255,0,255));
	charInfo = SDL_LoadBMP("../Images/battle/CharacterBattleInfo.bmp");
	SDL_SetColorKey(charInfo, SDL_SRCCOLORKEY, SDL_MapRGB(charInfo->format, 255,0,255));
	textFight[0] = TTF_RenderText_Blended(font, "Fight",fgColor);
	textRun[0] = TTF_RenderText_Blended(font,"Run",fgColor);
	textItem[0] = TTF_RenderText_Blended(font,"Item",fgColor);
	textMagic[0] = TTF_RenderText_Blended(font,"Skill",fgColor);
	textFight[1] = TTF_RenderText_Blended(font, "Fight",bgColor);
	textRun[1] = TTF_RenderText_Blended(font, "Run",bgColor);
	textItem[1] = TTF_RenderText_Blended(font,"Item",bgColor);
	textMagic[1] = TTF_RenderText_Blended(font,"Skill",bgColor);
	bgBattleMenuLoc.x = 0; bgBattleMenuLoc.y = 473; //463 = height(600) - 127(height of picture) + 10
	itemMagicMenuLoc.x = 195; itemMagicMenuLoc.y = 360;
	textBoxLoc.x = 0; textBoxLoc.y = 473;
	fightLoc.x = 25; fightLoc.y = 485;
	magicLoc.x = 25; magicLoc.y = 535;
	itemLoc.x = 165; itemLoc.y = 485;
	runLoc.x = 165; runLoc.y = 535;
	charInfoLoc.x = 0+594; charInfoLoc.y = 0;
	player = &Player::getInstance(); //just added this to test the battle sequence
	//setting up IDLE animations
	if(player->getType() == Player::LLYOD){
	player->setAnimation(BattleAnimations::IDLE,"../Images/battle/LloydIdle.bmp",6,10,98,106);
	for(int i = 5; i > -1; i--)
		player->getBattleAnimations().setFrame(BattleAnimations::IDLE,5-i,66*i,0,66,player->getBattleAnimations().getIdleImage()->h);
	}
	else{
		player->setAnimation(BattleAnimations::IDLE,"../Images/battle/ColetteIdle.bmp",5,0,128,255);
		for(int i = 4; i > -1; i--)
			player->getBattleAnimations().setFrame(BattleAnimations::IDLE,4-i,46*i,0,46,player->getBattleAnimations().getIdleImage()->h);
	}
	bManager = new BattleHandler();
	loadMobs();
}
Beispiel #2
0
Map::Map(int stage)
{
	_mapSize = 0;

	this->_stage = stage;

	loadInfo();
	loadPretties();
	loadAnimatedPretties();
	loadTile();
	loadMobs();
	loadSignatureObjects();

	// Concatenate all map object's reference to split into 4tree.
	vector<Object*> mapObjects;
	mapObjects.insert(mapObjects.end(), _pretties.begin(), _pretties.end());

	_mapObjects = new QuadTree(new RECT(Default::createRECT(0, _mapSize, _mapSize, 0)));
	_mapObjects->assign(mapObjects);
}