diff options
author | Federico Igne <git@federicoigne.com> | 2022-11-04 23:01:30 +0000 |
---|---|---|
committer | Federico Igne <git@federicoigne.com> | 2022-11-04 23:01:57 +0000 |
commit | a140a82cf417aec63fbe4f2430a8e272f4d5a254 (patch) | |
tree | 5c60bdfc8539651f355963bf100cda396c632d7b | |
parent | 39e97166b83531f3b1da69514653c7dd9e8810ff (diff) | |
download | raccoon-a140a82cf417aec63fbe4f2430a8e272f4d5a254.tar.gz raccoon-a140a82cf417aec63fbe4f2430a8e272f4d5a254.zip |
fix: reduce horizontal friction in mid air
-rw-r--r-- | raccoon.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/raccoon.lua b/raccoon.lua index 8db51ca..3b6f233 100644 --- a/raccoon.lua +++ b/raccoon.lua | |||
@@ -452,10 +452,14 @@ function MovementSystem:exec(entity) | |||
452 | -- AI | 452 | -- AI |
453 | end | 453 | end |
454 | -- Horizontal friction | 454 | -- Horizontal friction |
455 | local friction = .1 | ||
456 | if pos:on_ground() then | ||
457 | friction = .2 | ||
458 | end | ||
455 | if move.cur.x > 0 then | 459 | if move.cur.x > 0 then |
456 | move.cur.x = math.max(0, move.cur.x - .2) | 460 | move.cur.x = math.max(0, move.cur.x - friction) |
457 | else | 461 | else |
458 | move.cur.x = math.min(0, move.cur.x + .2) | 462 | move.cur.x = math.min(0, move.cur.x + friction) |
459 | end | 463 | end |
460 | -- Gravity | 464 | -- Gravity |
461 | move.cur.y = math.min(2, move.cur.y + .2) | 465 | move.cur.y = math.min(2, move.cur.y + .2) |