Skip to content

Commit

Permalink
Merge pull request #33 from nonorze-VOXX/easyRoad
Browse files Browse the repository at this point in the history
reslolve bloon speed disappear, throwable speed up ,remove init round start button
  • Loading branch information
huhuhu0420 authored Apr 6, 2023
2 parents 036234f + 233597a commit 1edd592
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 38 deletions.
22 changes: 11 additions & 11 deletions Source/Game/BtdClass/BloonFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ namespace Btd
tmpBloon.LoadBitmapByString(balloonPath, RGB(0, 0, 0));
tmpBloon.SetLayer(0);
tmpBloon.SetFrameIndexOfBitmap(0);
tmpBloon.SetTopLeft(static_cast<int>(startPosition.X),
static_cast<int>(startPosition.Y));
tmpBloon.SetBottomCenter(static_cast<int>(startPosition.X),
static_cast<int>(startPosition.Y));
tmpBloon.SetActive(false);
BloonPool.push(tmpBloon);
}
Expand All @@ -83,13 +83,16 @@ namespace Btd
next.SetLayer(type);
next.SetFrameIndexOfBitmap(type);
next.Setspeed(3);
// next.Setspeed(70);
next.Setspeed(
static_cast<float>(0.5 * static_cast<float>(next.GetLayer()) * static_cast<float>(next.GetLayer()) +
static_cast<float>(next.GetLayer()) +
3));
next.SetType(BloonType::normal);
break;
}
next.SetNowRouteTarget(nowRouteTarget);
next.SetTopLeft(static_cast<int>(startPosition.X),
static_cast<int>(startPosition.Y));
next.SetBottomCenter(static_cast<int>(startPosition.X),
static_cast<int>(startPosition.Y));
next.SetActive(true);
next.SetIsPoped(false);
next.SetIsGoaled(false);
Expand Down Expand Up @@ -117,10 +120,7 @@ namespace Btd
if (type == BloonType::black || type == BloonType::white)
{
int nowRouteTarget = BloonVector[i].GetNowRouteTarget();
Vector2 position = {
static_cast<float>(BloonVector[i].GetLeft()),
static_cast<float>(BloonVector[i].GetTop())
};
Vector2 position = b.GetBottomCenter();
MakeBloonByPosition(Layer::yellow, position, nowRouteTarget);
MakeBloonByPosition(Layer::yellow, position, nowRouteTarget);
}
Expand All @@ -132,9 +132,9 @@ namespace Btd

static void ClearActiveBloon()
{
for(auto &b : BloonVector)
for (auto& b : BloonVector)
{
BloonPool.push(b);
BloonPool.push(b);
}
BloonVector.clear();
}
Expand Down
39 changes: 21 additions & 18 deletions Source/Game/BtdClass/DartMonkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,36 @@ namespace Btd
{
DartMonkey::DartMonkey()
{
_range = 160;
ThrowablePath = {"resources/towers/monkey/dart_1.bmp", "resources/towers/monkey/dart_2.bmp", "resources/towers/monkey/dart_3.bmp"
, "resources/towers/monkey/dart_4.bmp", "resources/towers/monkey/dart_5.bmp", "resources/towers/monkey/dart_6.bmp"
, "resources/towers/monkey/dart_7.bmp", "resources/towers/monkey/dart_8.bmp"};

_range = 160;
ThrowablePath = {
"resources/towers/monkey/dart_1.bmp", "resources/towers/monkey/dart_2.bmp",
"resources/towers/monkey/dart_3.bmp", "resources/towers/monkey/dart_4.bmp",
"resources/towers/monkey/dart_5.bmp", "resources/towers/monkey/dart_6.bmp",
"resources/towers/monkey/dart_7.bmp", "resources/towers/monkey/dart_8.bmp"
};
}

void DartMonkey::Shoot(Vector2 target)
{
Tower::Shoot(target);
Tower::Shoot(target);
Vector2 targetDirection = {
(target.X - (float)GetCenter().X), target.Y - (float)GetCenter().Y
(target.X - GetCenter().X), target.Y - GetCenter().Y
};
throwables.back()->SetFrameIndexOfBitmap(GetFrameIndexByVector2(targetDirection));
this->SetFrameIndexOfBitmap(GetFrameIndexByVector2(targetDirection));
throwables.back()->SetSpeed(20);
throwables.back()->SetFrameIndexOfBitmap(GetFrameIndexByVector2(targetDirection));
this->SetFrameIndexOfBitmap(GetFrameIndexByVector2(targetDirection));
}

void DartMonkey::PushThrowablePool()
{
shared_ptr<Throwable> dart = make_shared<Throwable>(Throwable());
if (_isUpgrade[0])
{
// dart monkey first upgrade can let throwable penetrate
dart->SetPenetrate(true);
}
dart->LoadBitmapByString(ThrowablePath, RGB(255, 255, 255));
dart->SetSpeed(5);
throwablePool.push(dart);
auto dart = make_shared<Throwable>(Throwable());
if (_isUpgrade[0])
{
// dart monkey first upgrade can let throwable penetrate
dart->SetPenetrate(true);
}
dart->LoadBitmapByString(ThrowablePath, RGB(255, 255, 255));
dart->SetSpeed(5);
throwablePool.push(dart);
}
}
7 changes: 4 additions & 3 deletions Source/Game/BtdClass/NailMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Btd

void NailMachine::Update()
{
RangeCircle.SetCenter((int)GetCenter().X - (_range - 100),
(int)GetCenter().Y - (_range - 100));
RangeCircle.SetCenter(static_cast<int>(GetCenter().X) - (_range - 100),
static_cast<int>(GetCenter().Y) - (_range - 100));
if (_isActive)
{
UpdateThrowable();
Expand All @@ -32,6 +32,7 @@ namespace Btd
GetCenter().Y + direction.Y
};
Shoot(target);
throwables.back()->SetSpeed(20);
direction = Spin45(direction);
}
}
Expand All @@ -45,7 +46,7 @@ namespace Btd

void NailMachine::PushThrowablePool()
{
shared_ptr<Throwable> nail = make_shared<Throwable>(Throwable());
auto nail = make_shared<Throwable>(Throwable());
nail->LoadBitmapByString(ThrowablePath, RGB(255, 255, 255));
nail->SetSpeed(5);
throwablePool.push(nail);
Expand Down
2 changes: 1 addition & 1 deletion Source/Game/BtdClass/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Btd
switch (type)
{
case MapType::easy:
SetStartPosition({static_cast<float>(0), mapSize.Y * 0.4F});
SetStartPosition({static_cast<float>(0), mapSize.Y * 0.5F});
SetRoute({
{mapSize.X * 0.29F, mapSize.Y * 0.5F},
{mapSize.X * 0.29F, mapSize.Y * 0.25F},
Expand Down
2 changes: 0 additions & 2 deletions Source/Game/mygame.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ namespace game_framework
protected:
void OnShow() override; // 顯示這個狀態的遊戲畫面
private:
CMovingBitmap logo; // csie的logo
Btd::GameObject startButton;
Btd::Button _mapButton[3];
};

Expand Down
3 changes: 0 additions & 3 deletions Source/Game/mygame_initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ void CGameStateInit::OnInit()
//
// 此OnInit動作會接到CGameStaterRun::OnInit(),所以進度還沒到100%
//
startButton.LoadBitmapByString({"resources/start_button.bmp"});
startButton.SetTopLeft(742, 620);
_mapButton[0].LoadBitmapByString({"resources/easy.bmp", "resources/play.bmp"});
_mapButton[1].LoadBitmapByString({"resources/medium.bmp", "resources/play.bmp"});
_mapButton[2].LoadBitmapByString({"resources/hard.bmp", "resources/play.bmp"});
Expand Down Expand Up @@ -114,7 +112,6 @@ void CGameStateInit::OnShow()
{
map->ShowBackground();
map->ShowRoad();
startButton.ShowBitmap();
for (int i = 0; i < 3; i++)
{
_mapButton[i].ShowBitmap();
Expand Down

0 comments on commit 1edd592

Please sign in to comment.