mirror of
https://github.com/NoelFB/tiny_link.git
synced 2025-07-01 19:45:27 +08:00
everything except boss
This commit is contained in:
@ -17,7 +17,7 @@ namespace TL
|
||||
Grid
|
||||
};
|
||||
|
||||
uint32_t mask;
|
||||
uint32_t mask = 0;
|
||||
|
||||
Collider();
|
||||
|
||||
|
@ -38,7 +38,16 @@ bool Mover::move_y(int amount)
|
||||
|
||||
while (amount != 0)
|
||||
{
|
||||
if (collider->check(Mask::solid, Point(0, sign)))
|
||||
// if hit solid
|
||||
bool hit_something = collider->check(Mask::solid, Point(0, sign));
|
||||
|
||||
// no solid, but we're moving down, check for jumpthru
|
||||
// but ONLY if we're not already overlapping a jumpthru
|
||||
if (!hit_something && sign > 0)
|
||||
hit_something = collider->check(Mask::jumpthru, Point(0, sign)) && !collider->check(Mask::jumpthru, Point(0, 0));
|
||||
|
||||
// stop movement
|
||||
if (hit_something)
|
||||
{
|
||||
if (on_hit_y)
|
||||
on_hit_y(this);
|
||||
@ -82,7 +91,11 @@ bool Mover::on_ground(int dist) const
|
||||
if (!collider)
|
||||
return false;
|
||||
|
||||
return collider->check(Mask::solid, Point(0, dist));
|
||||
return
|
||||
// solid
|
||||
collider->check(Mask::solid, Point(0, dist)) ||
|
||||
// jumpthru
|
||||
(collider->check(Mask::jumpthru, Point(0, dist)) && !collider->check(Mask::jumpthru, Point(0, 0)));
|
||||
}
|
||||
|
||||
void Mover::update()
|
||||
|
@ -34,6 +34,6 @@ namespace TL
|
||||
float m_invincible_timer = 0;
|
||||
float m_start_timer = 1;
|
||||
Collider* m_attack_collider = nullptr;
|
||||
bool m_on_ground;
|
||||
bool m_on_ground = false;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user