]> code.bitgloo.com Git - clyne/game.git/commitdiff
collision tweak main
authorClyne Sullivan <clyne@bitgloo.com>
Sat, 1 Mar 2025 21:18:02 +0000 (16:18 -0500)
committerClyne Sullivan <clyne@bitgloo.com>
Sat, 1 Mar 2025 21:18:02 +0000 (16:18 -0500)
main.cpp

index 9f191a7ce4d170ffe85d7fd013457a264e4b832a..30e9f8df8d22e53f1525aa62c9a463b2fecbbca9 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -67,7 +67,11 @@ int main(int argc, const char *argv[])
             [&registry](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;