added walk behind.
This commit is contained in:
BIN
desktop/resources/house.png
Normal file
BIN
desktop/resources/house.png
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.9 KiB |
@@ -46,6 +46,7 @@
|
||||
(texture (aget player-sheet 1 i))))
|
||||
:anim (animation 0.075 (for [i (range 8)]
|
||||
(texture (aget player-sheet 0 i))))
|
||||
:baseline 95
|
||||
:x 150 :y 95 :x-velocity 1
|
||||
:id "ego"}]
|
||||
(merge (animation->texture screen (:anim ego)) ego)))
|
||||
@@ -66,6 +67,7 @@
|
||||
(merge (-> ego
|
||||
(update-in [:x] #(+ % vector-x))
|
||||
(update-in [:y] #(+ % vector-y))
|
||||
(assoc-in [:baseline] (- 240 (:y ego)))
|
||||
(assoc-in [:anim] (if (< vector-x 0)
|
||||
(:left ego)
|
||||
(:right ego))))
|
||||
@@ -78,16 +80,23 @@
|
||||
(update! screen :renderer (stage) :camera (orthographic))
|
||||
(let [
|
||||
_ (input! :set-cursor-image (cursor "cursor.png" 0) 0 0)
|
||||
background (texture "bg5.png")]
|
||||
background (texture "bg5.png")
|
||||
house (texture "house.png")]
|
||||
{:cursor {:id "cursor" :cursor-index 0}
|
||||
:background (assoc background :origin-y 0 :origin-x 0 :id "background" :x 0 :y 0 :scale-x 1 :scale-y 1 :collision (advent.pathfind/map-from-resource "pathfind-test-big.png"))
|
||||
:background (assoc background
|
||||
:id "background" :x 0 :y 0
|
||||
:collision (advent.pathfind/map-from-resource "pathfind-test-big.png")
|
||||
:baseline 0)
|
||||
:house (assoc house
|
||||
:x 0 :y 0
|
||||
:baseline 122)
|
||||
:ego (get-ego screen)}))
|
||||
|
||||
:on-render
|
||||
(fn [screen [entities]]
|
||||
(clear!)
|
||||
(let [entities (assoc entities :ego (update-ego screen entities (:ego entities)))]
|
||||
(render! screen (vals entities))
|
||||
(render! screen (sort-by :baseline (vals entities)))
|
||||
entities))
|
||||
:on-resize (fn [screen entities]
|
||||
(size! screen 320 240))
|
||||
|
||||
Reference in New Issue
Block a user