diff options
| author | Gene Pasquet <dev@etenil.net> | 2026-04-07 23:42:08 +0100 |
|---|---|---|
| committer | Gene Pasquet <dev@etenil.net> | 2026-04-07 23:42:08 +0100 |
| commit | cfddc2f180552afdb080968f847018c5a223b41a (patch) | |
| tree | 61f982e5ab20dc10c732c135d6e335531abface1 /tests | |
| parent | 19a5db8606a82830a5ccd0ed46d8e0cf3c95db0a (diff) | |
Use entities as platforms
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/physics-test.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/physics-test.scm b/tests/physics-test.scm index 04ec6bb..a5b40e9 100644 --- a/tests/physics-test.scm +++ b/tests/physics-test.scm @@ -376,6 +376,18 @@ (test-equal "a pushed up by 3" -3 (entity-ref ra #:y 0)) (test-equal "b pushed down by 3" 13 (entity-ref rb #:y 0)))) + (test-group "immovable: landing uses vertical separation when horizontal overlap is shallower" + ;; Without the landing rule, ovx < ovy would pick horizontal separation and shove the + ;; mover sideways off a narrow platform. Box center remains above shelf center → snap on top. + (let* ((shelf (list #:type 'static #:x 100 #:y 200 #:width 16 #:height 16 + #:solid? #t #:immovable? #t)) + (box (list #:type 'box #:x 92 #:y 196 #:width 16 #:height 16 + #:solid? #t #:immovable? #f #:vx 0 #:vy 0)) + (result (resolve-entity-collisions (list shelf box))) + (box2 (list-ref result 1))) + (test-equal "box rests on shelf top (y = shelf_y - height)" 184 (entity-ref box2 #:y 0)) + (test-equal "vy zeroed" 0 (entity-ref box2 #:vy 0)))) + (test-group "non-solid entity ignored" (let* ((a (make-solid 0 0 16 16)) (b (list #:type 'goal #:x 5 #:y 5 #:width 16 #:height 16)) |
