Skip to content

Commit

Permalink
Merge pull request #26 from PJ-FDU/June11
Browse files Browse the repository at this point in the history
Fix bugs
  • Loading branch information
zhaobenx authored Jun 11, 2017
2 parents 8a6371f + ad85ad1 commit 62d83aa
Show file tree
Hide file tree
Showing 45 changed files with 2,018 additions and 38 deletions.
26 changes: 22 additions & 4 deletions Classes/BattleScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,28 @@ void BattleScene::onExit()

void BattleScene::win()
{
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
auto win_label = LabelBMFont::create("You Win!", "fonts/AgencyFB.fnt");
win_label->setPosition(Vec2(origin.x + visibleSize.width / 2,
origin.y + visibleSize.height - win_label->getContentSize().height));
addChild(win_label, 40);

notice->displayNotice("You Win!");
end_flag = true;
}

void BattleScene::lose()
{
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
auto lose_label = LabelBMFont::create("You Lose!", "fonts/AgencyFB.fnt");
lose_label->setPosition(Vec2(origin.x + visibleSize.width / 2,
origin.y + visibleSize.height - lose_label->getContentSize().height));
addChild(lose_label, 40);

notice->displayNotice("You Lose");
start_flag = 0;
end_flag = true;
}

Scene* BattleScene::createScene(SocketClient* _socket_client, SocketServer* _socket_server)
Expand Down Expand Up @@ -233,7 +248,7 @@ bool BattleScene::init(SocketClient* _socket_client, SocketServer* _socket_serve



start_flag = 1;
start_flag = true;

return true;
}
Expand Down Expand Up @@ -374,6 +389,9 @@ void BattleScene::onTouchEnded(cocos2d::Touch* pTouch, cocos2d::Event* pEvent)

log("Map Touch Grid Point: (%d, %d)", map_touch_grid_point.x, map_touch_grid_point.y);

if (end_flag)
return;

if ((maptouch - last_maptouch).length() < MIN_SELECT_RECT_SIZE)
unit_manager->selectUnits(maptouch);
else
Expand Down Expand Up @@ -469,7 +487,7 @@ bool Money::init()
money = INITIAL_BUDGET;
char money_str[30];
sprintf(money_str, "%d", money);
return initWithString(money_str, "fonts/MoneyFont.fnt");
return initWithString(money_str, "fonts/AgencyFB.fnt");
}

void Money::updateMoneyDisplay()
Expand Down Expand Up @@ -527,5 +545,5 @@ void Notice::displayNotice(std::string ntc)
bool Notice::init()
{
ntc_life = 100;
return initWithString("Welcome to FudanCraft!", "fonts/NoticeFont.fnt");
return initWithString("Welcome to FudanCraft!", "fonts/AgencyFB.fnt");
}
3 changes: 2 additions & 1 deletion Classes/BattleScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class BattleScene : public cocos2d::Layer
SocketServer* socket_server = nullptr;
SocketClient* socket_client = nullptr;

int start_flag = 0;
bool start_flag = false;
bool end_flag = false;

cocos2d::TMXTiledMap* battle_map = nullptr;
GridMap* grid_map = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Buliding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void Tower::setProperties()
mobile = false;

auto_atk_freq = 50;
auto_atk_range = GridSize(9, 9);
auto_atk_range = GridSize(11, 11);

size = GridSize(1, 1);

Expand Down
2 changes: 1 addition & 1 deletion Classes/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ void UnitManager::updateUnitsState()
if (unit_1->type == 5)
{
CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("audio/baseunderatack.wav");
sprintf(ntc, "Our base is under attack, damage %d", unitid_1, damage);
sprintf(ntc, "Our base is under attack, damage %d", damage);
}
else
sprintf(ntc, "Unit %d under attack, damage %d", unitid_1, damage);
Expand Down
Binary file added documents/FudanCraft.pptx
Binary file not shown.
Binary file added documents/FudanCraft用户手册.pdf
Binary file not shown.
Loading

0 comments on commit 62d83aa

Please sign in to comment.