aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2025-03-01 16:18:02 -0500
committerClyne Sullivan <clyne@bitgloo.com>2025-03-01 16:18:02 -0500
commit374005137721b99bca01c8368437641bc2984228 (patch)
tree2b53f581050733cb0d98183f010b74dd2b54724c
parent779fd068b6aadef909aefdd25d6ec4086300dde2 (diff)
collision tweakHEADmain
-rw-r--r--main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 9f191a7..30e9f8d 100644
--- 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;