diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2025-03-01 16:18:02 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2025-03-01 16:18:02 -0500 |
commit | 374005137721b99bca01c8368437641bc2984228 (patch) | |
tree | 2b53f581050733cb0d98183f010b74dd2b54724c | |
parent | 779fd068b6aadef909aefdd25d6ec4086300dde2 (diff) |
-rw-r--r-- | main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -67,7 +67,11 @@ int main(int argc, const char *argv[]) [®istry](auto& s, auto& p) { registry.view<Player, Point, Velocity, Texture>().each( [&s, &p](auto& _, auto& pp, auto& pv, auto& pt) { - if (const auto c = s.collision(pp + pt.dim()); c) { + auto dim = pt.dim(); + + if (const auto c = s.collision(pp + dim); c) { + pv.y = (std::abs(c) > 1.f) ? c * 0.25f : 0.f; + } else if (const auto c = s.collision(pp + Point(0, dim.y)); c) { pv.y = (std::abs(c) > 1.f) ? c * 0.25f : 0.f; } else { pv.y += 0.1f; |