mirror of
https://github.com/wu736139669/OzgGameRPG.git
synced 2026-08-06 06:41:57 +00:00
改变大小和调整战斗画面的各个元素的位置
This commit is contained in:
@@ -30,7 +30,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
|
||||
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(1024, 768, kResolutionShowAll);
|
||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(960, 640, kResolutionShowAll);
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(false);
|
||||
|
||||
+11
-11
@@ -64,34 +64,34 @@ bool RPGBattleMenu::initWithParentNode(CCDictionary* stringList, CppSQLite3DB* d
|
||||
if(!bgLayer)
|
||||
{
|
||||
bgLayer = CCTMXTiledMap::create("battle_battlemenu_style1.tmx");
|
||||
bgLayer->setPosition(ccp(750, 64));
|
||||
bgLayer->setPosition(ccp(718, 0));
|
||||
bgLayer->setTag(kRPGBattleMenuTagBg);
|
||||
parentNode->addChild(bgLayer);
|
||||
}
|
||||
|
||||
//角色名字
|
||||
addLab(this->m_parentNode, kRPGBattleMenuTagNameLab, CCString::create(playerData->m_name), 20, kCCTextAlignmentCenter, ccp(830, 292));
|
||||
addLab(this->m_parentNode, kRPGBattleMenuTagNameLab, CCString::create(playerData->m_name), 20, kCCTextAlignmentCenter, ccp(798, 228));
|
||||
CCLabelTTF *nameLab = (CCLabelTTF*)this->m_parentNode->getChildByTag(kRPGBattleMenuTagNameLab);
|
||||
nameLab->setFontFillColor(ccc3(144, 144, 144));
|
||||
|
||||
//分割线
|
||||
CCSprite *separate = CCSprite::createWithSpriteFrameName("separate.png");
|
||||
separate->setTag(kRPGBattleMenuTagSeparate);
|
||||
separate->setPosition(ccp(830, 275));
|
||||
separate->setPosition(ccp(798, 211));
|
||||
separate->setScaleX(0.34);
|
||||
this->m_parentNode->addChild(separate);
|
||||
|
||||
CCString *menuAttackStr = (CCString*)this->m_stringList->objectForKey("battle_playermenu_attack");
|
||||
this->createMenuItem(830, 250, menuAttackStr, kRPGBattleMenuTagAttack);
|
||||
this->createMenuItem(798, 186, menuAttackStr, kRPGBattleMenuTagAttack);
|
||||
|
||||
CCString *menuSkillStr = (CCString*)this->m_stringList->objectForKey("battle_playermenu_skill");
|
||||
this->createMenuItem(830, 200, menuSkillStr, kRPGBattleMenuTagSkill);
|
||||
this->createMenuItem(798, 136, menuSkillStr, kRPGBattleMenuTagSkill);
|
||||
|
||||
CCString *menuItemsStr = (CCString*)this->m_stringList->objectForKey("battle_playermenu_items");
|
||||
this->createMenuItem(830, 150, menuItemsStr, kRPGBattleMenuTagItems);
|
||||
this->createMenuItem(798, 86, menuItemsStr, kRPGBattleMenuTagItems);
|
||||
|
||||
CCString *menuEscapeStr = (CCString*)this->m_stringList->objectForKey("battle_playermenu_escape");
|
||||
this->createMenuItem(830, 100, menuEscapeStr, kRPGBattleMenuTagEscape);
|
||||
this->createMenuItem(798, 36, menuEscapeStr, kRPGBattleMenuTagEscape);
|
||||
|
||||
SimpleAudioEngine::sharedEngine()->playEffect("audio_battle_menu.wav");
|
||||
|
||||
@@ -194,7 +194,7 @@ void RPGBattleMenu::onMenu(cocos2d::CCObject *pObject)
|
||||
this->m_selectedMenuTag = kRPGBattleMenuTagSkill;
|
||||
|
||||
CCMenuItemSprite *menuCancel = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGBattleMenu::onMenu));
|
||||
menuCancel->setPosition(ccp(75, 660));
|
||||
menuCancel->setPosition(ccp(43, 596));
|
||||
menuCancel->setTag(kRPGBattleMenuTagCancel);
|
||||
menuCancel->setScale(0.75);
|
||||
this->addChild(menuCancel);
|
||||
@@ -290,7 +290,7 @@ void RPGBattleMenu::onMenu(cocos2d::CCObject *pObject)
|
||||
this->m_selectedMenuTag = kRPGBattleMenuTagItems;
|
||||
|
||||
CCMenuItemSprite *menuCancel = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGBattleMenu::onMenu));
|
||||
menuCancel->setPosition(ccp(75, 660));
|
||||
menuCancel->setPosition(ccp(43, 596));
|
||||
menuCancel->setTag(kRPGBattleMenuTagCancel);
|
||||
menuCancel->setScale(0.75);
|
||||
this->addChild(menuCancel);
|
||||
@@ -441,7 +441,7 @@ void RPGBattleMenu::onMenu(cocos2d::CCObject *pObject)
|
||||
this->m_selectedMenuTag = kRPGBattleMenuTagAttack;
|
||||
|
||||
CCMenuItemSprite *menuCancel = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGBattleMenu::onMenu));
|
||||
menuCancel->setPosition(ccp(75, 660));
|
||||
menuCancel->setPosition(ccp(43, 596));
|
||||
menuCancel->setTag(kRPGBattleMenuTagCancel);
|
||||
menuCancel->setScale(0.75);
|
||||
this->addChild(menuCancel);
|
||||
@@ -462,7 +462,7 @@ void RPGBattleMenu::onButton(cocos2d::CCObject *pSender, CCControlEvent event)
|
||||
menuCancel->setVisible(false);
|
||||
|
||||
CCMenuItemSprite *menuCancel2 = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGBattleMenu::onMenu));
|
||||
menuCancel2->setPosition(ccp(75, 660));
|
||||
menuCancel2->setPosition(ccp(43, 596));
|
||||
menuCancel2->setTag(kRPGBattleMenuTagCancel2);
|
||||
menuCancel2->setScale(0.75);
|
||||
this->addChild(menuCancel2);
|
||||
|
||||
@@ -107,10 +107,10 @@ bool RPGBattleSceneLayer::init()
|
||||
//加载已有道具 end
|
||||
|
||||
//player
|
||||
float playerY = 620;
|
||||
float separateY = 197;
|
||||
float playerLabY = 215;
|
||||
float progressY = 217;
|
||||
float playerY = 556;
|
||||
float separateY = 133;
|
||||
float playerLabY = 151;
|
||||
float progressY = 153;
|
||||
|
||||
int i = 0;
|
||||
|
||||
@@ -150,7 +150,7 @@ bool RPGBattleSceneLayer::init()
|
||||
|
||||
//角色
|
||||
RPGBattlePlayerSprite *player = RPGBattlePlayerSprite::createWithPlayerData(playerData);
|
||||
player->setPosition(ccp(880, playerY));
|
||||
player->setPosition(ccp(848, playerY));
|
||||
player->setTag(kRPGBattleSceneLayerTagPlayer + playerData->m_dataId);
|
||||
this->addChild(player);
|
||||
|
||||
@@ -160,7 +160,7 @@ bool RPGBattleSceneLayer::init()
|
||||
if(i > 0)
|
||||
{
|
||||
CCSprite *separate = CCSprite::createWithSpriteFrameName("separate.png");
|
||||
separate->setPosition(ccp(665, separateY));
|
||||
separate->setPosition(ccp(633, separateY));
|
||||
separate->setScaleX(1.4);
|
||||
this->addChild(separate);
|
||||
|
||||
@@ -168,12 +168,12 @@ bool RPGBattleSceneLayer::init()
|
||||
}
|
||||
|
||||
//名字
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerNameLab + playerData->m_dataId, CCString::create(playerData->m_name), 18, ccp(575, playerLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerNameLab + playerData->m_dataId, CCString::create(playerData->m_name), 18, ccp(543, playerLabY));
|
||||
|
||||
//进度条
|
||||
CCSprite *battleProgressBg = CCSprite::createWithSpriteFrameName("gui_battle_progress_bar01_a.png");
|
||||
battleProgressBg->setTag(kRPGBattleSceneLayerTagPlayerProgressBg + playerData->m_dataId);
|
||||
battleProgressBg->setPosition(ccp(880, progressY));
|
||||
battleProgressBg->setPosition(ccp(848, progressY));
|
||||
battleProgressBg->setScaleX(0.4);
|
||||
battleProgressBg->setScaleY(0.5);
|
||||
this->addChild(battleProgressBg);
|
||||
@@ -182,7 +182,7 @@ bool RPGBattleSceneLayer::init()
|
||||
battleProgress->setBarChangeRate(ccp(1, 0)); //设置进度条的长度和高度开始变化的大小
|
||||
battleProgress->setType(kCCProgressTimerTypeBar); //设置进度条为水平
|
||||
battleProgress->setMidpoint(ccp(0, 0));
|
||||
battleProgress->setPosition(ccp(880, progressY));
|
||||
battleProgress->setPosition(ccp(848, progressY));
|
||||
battleProgress->setScaleX(0.4);
|
||||
battleProgress->setScaleY(0.5);
|
||||
battleProgress->setTag(kRPGBattleSceneLayerTagPlayerProgress + playerData->m_dataId);
|
||||
@@ -194,14 +194,14 @@ bool RPGBattleSceneLayer::init()
|
||||
//CCLog("%f", progress);
|
||||
|
||||
//HP
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerHP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_HP), 18, kCCTextAlignmentRight, ccp(380, playerLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerHPSeparate + playerData->m_dataId, CCString::create("/"), 18, kCCTextAlignmentCenter, ccp(590, playerLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMaxHP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_maxHP), 18, kCCTextAlignmentLeft, ccp(800, playerLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerHP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_HP), 18, kCCTextAlignmentRight, ccp(348, playerLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerHPSeparate + playerData->m_dataId, CCString::create("/"), 18, kCCTextAlignmentCenter, ccp(558, playerLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMaxHP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_maxHP), 18, kCCTextAlignmentLeft, ccp(768, playerLabY));
|
||||
|
||||
//MP
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_MP), 15, kCCTextAlignmentRight, ccp(510, playerLabY - 3));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMPSeparate + playerData->m_dataId, CCString::create("/"), 15, kCCTextAlignmentCenter, ccp(720, playerLabY - 3));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMaxMP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_maxMP), 15, kCCTextAlignmentLeft, ccp(930, playerLabY - 3));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_MP), 15, kCCTextAlignmentRight, ccp(478, playerLabY - 3));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMPSeparate + playerData->m_dataId, CCString::create("/"), 15, kCCTextAlignmentCenter, ccp(688, playerLabY - 3));
|
||||
addLab(this, kRPGBattleSceneLayerTagPlayerMaxMP + playerData->m_dataId, CCString::createWithFormat("%i", playerData->m_maxMP), 15, kCCTextAlignmentLeft, ccp(898, playerLabY - 3));
|
||||
|
||||
playerY -= 100;
|
||||
playerLabY -= 40;
|
||||
@@ -285,7 +285,7 @@ bool RPGBattleSceneLayer::init()
|
||||
}
|
||||
|
||||
//怪物显示部分
|
||||
float monsterNameLabY = 220;
|
||||
float monsterNameLabY = 156;
|
||||
|
||||
this->m_addedMonsters.clear();
|
||||
|
||||
@@ -307,7 +307,7 @@ bool RPGBattleSceneLayer::init()
|
||||
//左下角的怪物名称
|
||||
if(j == 0)
|
||||
{
|
||||
addLab(this, kRPGBattleSceneLayerTagMonsterNameLab + monsterData->m_dataId, CCString::createWithFormat("%s x %i", monsterData->m_name.c_str(), (int)monsters->count()), 18, ccp(270, monsterNameLabY));
|
||||
addLab(this, kRPGBattleSceneLayerTagMonsterNameLab + monsterData->m_dataId, CCString::createWithFormat("%s x %i", monsterData->m_name.c_str(), (int)monsters->count()), 18, ccp(238, monsterNameLabY));
|
||||
|
||||
monsterNameLabY -= 40;
|
||||
}
|
||||
@@ -752,7 +752,7 @@ void RPGBattleSceneLayer::showMsg(cocos2d::CCString *msgText, bool autoRelease)
|
||||
}
|
||||
|
||||
bgLayer = CCTMXTiledMap::create("battle_msg_style1.tmx");
|
||||
bgLayer->setPosition(ccp((CCDirector::sharedDirector()->getWinSize().width - bgLayer->getContentSize().width) / 2, 657));
|
||||
bgLayer->setPosition(ccp((CCDirector::sharedDirector()->getWinSize().width - bgLayer->getContentSize().width) / 2, 593));
|
||||
bgLayer->setTag(kRPGBattleSceneLayerTagMsg);
|
||||
this->addChild(bgLayer);
|
||||
|
||||
@@ -1215,7 +1215,7 @@ CCArray* RPGBattleSceneLayer::monsterDataListWithDataId(int dataId)
|
||||
void RPGBattleSceneLayer::setMonsterPosition(RPGBattleMonsterSprite* monster)
|
||||
{
|
||||
// CCLayerColor *l = CCLayerColor::create(ccc4(200, 200, 200, 200), 700, 420);
|
||||
// l->setPosition(ccp(50, 270));
|
||||
// l->setPosition(ccp(18, 206));
|
||||
// this->addChild(l);
|
||||
|
||||
bool overlap; //是否重叠
|
||||
@@ -1223,8 +1223,8 @@ void RPGBattleSceneLayer::setMonsterPosition(RPGBattleMonsterSprite* monster)
|
||||
{
|
||||
overlap = false;
|
||||
|
||||
float x = OzgCCUtility::randomFloat(50 + (monster->getContentSize().width * monster->getAnchorPoint().x), 750 - ((monster->getContentSize().width * monster->getAnchorPoint().x)));
|
||||
float y = OzgCCUtility::randomFloat(270 + (monster->getContentSize().height * monster->getAnchorPoint().y), 690 - (monster->getContentSize().height * monster->getAnchorPoint().y));
|
||||
float x = OzgCCUtility::randomFloat(18 + (monster->getContentSize().width * monster->getAnchorPoint().x), 718 - ((monster->getContentSize().width * monster->getAnchorPoint().x)));
|
||||
float y = OzgCCUtility::randomFloat(206 + (monster->getContentSize().height * monster->getAnchorPoint().y), 626 - (monster->getContentSize().height * monster->getAnchorPoint().y));
|
||||
|
||||
monster->setPosition(ccp(x, y));
|
||||
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user