summaryrefslogtreecommitdiff
path: root/game.scm
diff options
context:
space:
mode:
Diffstat (limited to 'game.scm')
-rw-r--r--game.scm37
1 files changed, 20 insertions, 17 deletions
diff --git a/game.scm b/game.scm
index 7b93efa..296dc3a 100644
--- a/game.scm
+++ b/game.scm
@@ -432,13 +432,14 @@
body ...
(loop)))
(define* (tween proc duration start end ease interpolate)
- (let loop ((t 0))
- (if (= t duration)
- (proc end)
- (let ((alpha (ease (/ t duration))))
- (proc (interpolate start end alpha))
- (wait 1)
- (loop (+ t 1))))))
+ (let ((d (inexact duration)))
+ (let loop ((t 0))
+ (if (= t duration)
+ (proc end)
+ (let ((alpha (ease (/ (inexact t) d))))
+ (proc (interpolate start end alpha))
+ (wait 1)
+ (loop (+ t 1)))))))
;; Particles:
(define-type particle-pool
@@ -634,11 +635,13 @@
(define *last-scroll* 0.0)
(define *scroll-speed* 0.5)
(define (change-scroll-speed new-speed duration)
- (tween (lambda (speed)
- (set! *scroll-speed* speed))
- duration
- *scroll-speed* new-speed
- smoothstep lerp))
+ (run-script
+ (lambda ()
+ (tween (lambda (speed)
+ (set! *scroll-speed* speed))
+ duration
+ *scroll-speed* new-speed
+ smoothstep lerp))))
(define *last-row-scanned* 0)
;; action id, sprite sheet offset, x, y
(define %tile-size (+ 4 8 8 8))
@@ -721,9 +724,9 @@
('boss (spawn-boss x y))
('scroll-speed
(let ((speed (assq-ref properties 'speed))
- (ticks (or (assq-ref properties 'ticks) 0)))
+ (duration (or (assq-ref properties 'duration) 0)))
(when speed
- (change-scroll-speed speed ticks))))
+ (change-scroll-speed speed duration))))
(_ #t)))
(define max-scroll (- (* (level-height level) tile-height) game-height))
(define (level-update! level)
@@ -1105,9 +1108,9 @@
(if (or (rect-collides-with-level? level x y hbw hbh)
(find-enemy enemies x y hbw hbh))
(begin
- (set-vec2-x! player-position old-x)
- (set-vec2-y! player-position
- (+ old-y (- *scroll* *last-scroll*)))
+ ;; (set-vec2-x! player-position old-x)
+ ;; (set-vec2-y! player-position
+ ;; (+ old-y (- *scroll* *last-scroll*)))
(player-die!))
(begin
(set-vec2-x! player-hitbox-position (- x (/ hbw 2.0)))