Add simple wipe effect for undo.
This commit is contained in:
parent
98ae464ab9
commit
aa8a302fcb
2 changed files with 12 additions and 4 deletions
3
game.scm
3
game.scm
|
@ -108,7 +108,8 @@
|
||||||
((snapshot . older-snapshots)
|
((snapshot . older-snapshots)
|
||||||
(set! *actormap* snapshot)
|
(set! *actormap* snapshot)
|
||||||
(set! *snapshots* older-snapshots)
|
(set! *snapshots* older-snapshots)
|
||||||
(play-sound-effect audio:undo))))
|
(play-sound-effect audio:undo)
|
||||||
|
(show-effect! (make-wipe-effect 0.25)))))
|
||||||
|
|
||||||
(define (sort lst compare)
|
(define (sort lst compare)
|
||||||
(match lst
|
(match lst
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
draw-effect
|
draw-effect
|
||||||
|
|
||||||
make-fade-out+in-effect
|
make-fade-out+in-effect
|
||||||
make-screen-shake-effect))
|
make-screen-shake-effect
|
||||||
|
make-wipe-effect))
|
||||||
|
|
||||||
(define (ease:smoothstep t)
|
(define (ease:smoothstep t)
|
||||||
(* t t (- 3 (* 2 t))))
|
(* t t (- 3 (* 2 t))))
|
||||||
|
@ -61,8 +62,8 @@
|
||||||
(define (make-fade-out+in-effect duration)
|
(define (make-fade-out+in-effect duration)
|
||||||
(define (draw context t)
|
(define (draw context t)
|
||||||
(if (< t 0.5)
|
(if (< t 0.5)
|
||||||
(set-global-alpha! context (pk 'alpha-out (* t 2.0)))
|
(set-global-alpha! context (* t 2.0))
|
||||||
(set-global-alpha! context (pk 'alpha-in (- 1.0 (* (- t 0.5) 2.0)))))
|
(set-global-alpha! context (- 1.0 (* (- t 0.5) 2.0))))
|
||||||
(set-fill-color! context "#000000")
|
(set-fill-color! context "#000000")
|
||||||
(fill-rect context 0.0 0.0 game-width game-height)
|
(fill-rect context 0.0 0.0 game-width game-height)
|
||||||
(set-global-alpha! context 1.0))
|
(set-global-alpha! context 1.0))
|
||||||
|
@ -74,3 +75,9 @@
|
||||||
(y (round (random))))
|
(y (round (random))))
|
||||||
(translate! context x y)))
|
(translate! context x y)))
|
||||||
(make-effect 'pre duration draw))
|
(make-effect 'pre duration draw))
|
||||||
|
|
||||||
|
(define (make-wipe-effect duration)
|
||||||
|
(define (draw context t)
|
||||||
|
(set-fill-color! context "#222034")
|
||||||
|
(fill-rect context 0.0 0.0 (* game-width (- 1.0 t)) game-height))
|
||||||
|
(make-effect 'post duration draw))
|
||||||
|
|
Loading…
Add table
Reference in a new issue