diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index d82b3701..418cebc1 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -56,14 +56,23 @@ (script entities) entities)) +(defn flip [anim] + (animation (animation! anim :get-frame-duration) + (for [src-frame (animation! anim :get-key-frames) + :let [frame (texture (texture! src-frame :get-texture))]] + (do + (texture! frame :set-region src-frame) + (texture! frame :flip true false) + frame)))) + (defn get-ego [screen] (let [player-sheet (texture! (texture "player.png") :split 18 36) talk-sheet (texture! (texture "ego/talk.png") :split 18 36) stand-sheet (texture! (texture "ego/stand.png") :split 18 36) - ego {:right (animation 0.075 (for [i (range 8)] - (texture (aget player-sheet 0 i)))) - :left (animation 0.075 (for [i (range 8)] - (texture (aget player-sheet 1 i)))) + walk-right (animation 0.075 (for [i (range 8)] + (texture (aget player-sheet 0 i)))) + ego {:right walk-right + :left (flip walk-right) :talk (animation 0.2 (for [i (range 8)] (texture (aget talk-sheet 0 i)))) :stand (animation 0.1 (for [i (flatten [(repeat 6 [(repeat 10 0) (repeat 3 1) (repeat 20 0)]) 3 4 5 5 5 6 5 6 5 6 5 4 3 ])]