Fix Pterosaur.
This commit is contained in:
parent
7b1b5feaff
commit
da1a8d4a6f
|
@ -41,9 +41,9 @@ public:
|
|||
return
|
||||
{
|
||||
Posi.x - Size.x * Anch.x,
|
||||
Posi.y - Size.y * Anch.y,
|
||||
Posi.x + Size.x * (1.f - Anch.x),
|
||||
Posi.y + Size.y * (1.f - Anch.y),
|
||||
Posi.x + Size.x * (1.f - Anch.x),
|
||||
Posi.y - Size.y * Anch.y,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -65,12 +65,16 @@ void Game::Update()
|
|||
background.OnUpdate(delta);
|
||||
score += obs.speed * delta;
|
||||
score.OnUpdate(delta);
|
||||
if (isIntersection(steve.getRect(), obs.getRect()))
|
||||
{
|
||||
status = End;
|
||||
steve.status = Steve::Dead;
|
||||
steve.imge.rect = Steve::DeadRect;
|
||||
steve.Size = steve.imge.rect.size();
|
||||
auto s_r = steve.getRect();
|
||||
auto o_r = obs.getRect();
|
||||
if (isIntersection(s_r, o_r))
|
||||
{
|
||||
status = End;
|
||||
steve.status = Steve::Dead;
|
||||
steve.imge.rect = Steve::DeadRect;
|
||||
steve.Size = steve.imge.rect.size();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Game::End:
|
||||
|
|
|
@ -29,7 +29,7 @@ export struct Obstacle : GameObject
|
|||
{ 850,2,952,102 },
|
||||
//Qradro Giant Cactus
|
||||
{ 802,2,952,102 },
|
||||
//
|
||||
// Pterosaur
|
||||
{ 260,2,352,82 },
|
||||
{ 352,2,444,82 },
|
||||
};
|
||||
|
@ -66,11 +66,11 @@ export struct Obstacle : GameObject
|
|||
std::mt19937 random{std::random_device()()};
|
||||
void Reset()
|
||||
{
|
||||
int index = 14;// random() % 15;
|
||||
int index = random() % 15;
|
||||
if (index == 14)
|
||||
{
|
||||
isCactus = false;
|
||||
Posi.y = 125;
|
||||
Posi.y = 120;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@ export struct Steve : GameObject
|
|||
static constexpr Rect LeftRect = { 1942, 2, 2030, 96 };
|
||||
static constexpr Rect BigEyeRect = { 2030, 2, 2118, 96 };
|
||||
static constexpr Rect DeadRect = { 2122, 2, 2202, 96 };
|
||||
static constexpr Rect CrawlingRightRect = { 2203, 2, 2321, 96 };
|
||||
static constexpr Rect CrawlingLeftRect = { 2321, 2, 2439, 96 };
|
||||
static constexpr Rect CrawlingRightRect = { 2203, 36, 2321, 96 };
|
||||
static constexpr Rect CrawlingLeftRect = { 2321, 36, 2439, 96 };
|
||||
|
||||
enum Status { Idle, Running, Jumping, Freefall, Crawling, Dead } status;
|
||||
|
||||
|
|
Loading…
Reference in New Issue