diff options
-rw-r--r-- | game.scm | 37 | ||||
-rw-r--r-- | level.tmx | 106 |
2 files changed, 73 insertions, 70 deletions
@@ -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))) @@ -75,29 +75,29 @@ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0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6,6,6,0,0,0,0,0,0,0,0,6,6,6, 6,6,6,6,0,0,0,6,6,6,6,6,6,6,6, 6,6,6,6,0,0,0,6,6,6,6,6,6,6,6, 6,6,6,6,0,0,0,6,6,6,6,6,6,6,6, @@ -1051,7 +1051,7 @@ <object id="71" type="scroll-speed" x="0" y="4992" width="16" height="16"> <properties> <property name="duration" type="int" value="30"/> - <property name="speed" type="float" value="0.25"/> + <property name="speed" type="float" value="0.4"/> </properties> </object> <object id="72" type="scroll-speed" x="0" y="7984" width="16" height="16"> @@ -1155,9 +1155,9 @@ <property name="speed" type="float" value="0"/> </properties> </object> - <object id="164" type="scroll-speed" x="0" y="2704" width="16" height="16"> + <object id="164" type="scroll-speed" x="0" y="2512" width="16" height="16"> <properties> - <property name="duration" type="int" value="60"/> + <property name="duration" type="int" value="120"/> <property name="speed" type="float" value="0.5"/> </properties> </object> @@ -1167,13 +1167,13 @@ <property name="speed" type="float" value="2"/> </properties> </object> - <object id="166" type="scroll-speed" x="0" y="784" width="16" height="16"> + <object id="166" type="scroll-speed" x="0" y="736" width="16" height="16"> <properties> <property name="duration" type="int" value="120"/> - <property name="speed" type="float" value="0.5"/> + <property name="speed" type="float" value="0.25"/> </properties> </object> - <object id="167" type="scroll-speed" x="0" y="640" width="16" height="16"> + <object id="167" type="scroll-speed" x="0" y="400" width="16" height="16"> <properties> <property name="duration" type="int" value="30"/> <property name="speed" type="float" value="0.5"/> @@ -1182,7 +1182,7 @@ <object id="169" type="scroll-speed" x="0" y="3824" width="16" height="16"> <properties> <property name="duration" type="int" value="60"/> - <property name="speed" type="float" value="1.5"/> + <property name="speed" type="float" value="2"/> </properties> </object> </objectgroup> |