diff options
Diffstat (limited to 'physics.scm')
| -rw-r--r-- | physics.scm | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/physics.scm b/physics.scm index d418539..b95fc86 100644 --- a/physics.scm +++ b/physics.scm @@ -32,25 +32,25 @@ ;; for #:skip-pipelines symbol names). ;; Consume #:ay into #:vy and clear it (one-shot acceleration) - (define-pipeline (apply-acceleration acceleration) (entity scene dt) + (define-pipeline (apply-acceleration acceleration) (scene entity dt) guard: (entity-ref entity #:gravity? #f) (let ((ay (entity-ref entity #:ay 0)) (vy (entity-ref entity #:vy 0))) (entity-set (entity-set entity #:vy (+ vy ay)) #:ay 0))) ;; Apply gravity to an entity if it has gravity enabled - (define-pipeline (apply-gravity gravity) (entity scene dt) + (define-pipeline (apply-gravity gravity) (scene entity dt) guard: (entity-ref entity #:gravity? #f) (entity-set entity #:vy (+ (entity-ref entity #:vy) *gravity*))) ;; Update entity's x by its vx velocity - (define-pipeline (apply-velocity-x velocity-x) (entity scene dt) + (define-pipeline (apply-velocity-x velocity-x) (scene entity dt) (let ((x (entity-ref entity #:x 0)) (vx (entity-ref entity #:vx 0))) (entity-set entity #:x (+ x vx)))) ;; Update entity's y by its vy velocity - (define-pipeline (apply-velocity-y velocity-y) (entity scene dt) + (define-pipeline (apply-velocity-y velocity-y) (scene entity dt) (let ((y (entity-ref entity #:y 0)) (vy (entity-ref entity #:vy 0))) (entity-set entity #:y (+ y vy)))) @@ -128,7 +128,7 @@ (entity-tile-cells entity tilemap))))) ;; Resolve horizontal collisions with solid tiles - (define-pipeline (resolve-tile-collisions-x tile-collisions-x) (entity scene dt) + (define-pipeline (resolve-tile-collisions-x tile-collisions-x) (scene entity dt) guard: (scene-tilemap scene) (let* ((tilemap (scene-tilemap scene)) (w (entity-ref entity #:width 0)) @@ -137,7 +137,7 @@ (lambda (v col row) (tile-push-pos v col tw w))))) ;; Resolve vertical collisions with solid tiles - (define-pipeline (resolve-tile-collisions-y tile-collisions-y) (entity scene dt) + (define-pipeline (resolve-tile-collisions-y tile-collisions-y) (scene entity dt) guard: (scene-tilemap scene) (let* ((tilemap (scene-tilemap scene)) (h (entity-ref entity #:height 0)) @@ -179,7 +179,7 @@ (or (not (zero? (tilemap-tile-at tilemap col-left row))) (not (zero? (tilemap-tile-at tilemap col-right row)))))) - (define-pipeline (detect-on-solid on-solid) (entity scene dt) + (define-pipeline (detect-on-solid on-solid) (scene entity dt) guard: (entity-ref entity #:gravity? #f) (let* ((tilemap (scene-tilemap scene)) (on-tile? (and tilemap (tile-ground-below? entity tilemap))) |
