fix rubbish last commit

master
Josha von Gizycki 6 years ago
parent 9b61fdc888
commit 71160351d1

@ -118,7 +118,8 @@
(get-in gamestate [:dimensions :w])
(get-in gamestate [:dimensions :h]))
(let [scenekey (:scene gamestate)
drawfunc (get-in gamestate [:scenes scenekey :draw])]
scene (get-in gamestate [:scenes scenekey])
drawfunc (:draw scene)]
(drawfunc gamestate scene))
(draw-fps gamestate))

@ -5,35 +5,33 @@
[topdown2d.sprites :as sprites]))
(defn init [gamestate scenestate]
(assoc
(merge
scenestate
:player
{:x (- (/ (get-in gamestate [:dimensions :w]) 2) 32)
:y (- (/ (get-in gamestate [:dimensions :h]) 2) 32)
:w 64 :h 64
:d :s
:sprite
{:image (.getElementById js/document "demo-player")
:size 64
:rows {:w 1 :e 3
:n 0 :s 2
:? 2}
:cycle {:pos 0
:from 1
:count 8
:last-cycle 0
;; seconds per cycle
:spc 0.08}}}
:viewport
{:image (.getElementById js/document "demo-background")
:keep-in {:x 0 :y 0
:w 2239 :h 2235}
:x 1 :y 1
:d :?
;; pixels per second
:pps 350
:w (get-in gamestate [:dimensions :w])
:h (get-in gamestate [:dimensions :h])}))
{:player {:x (- (/ (get-in gamestate [:dimensions :w]) 2) 32)
:y (- (/ (get-in gamestate [:dimensions :h]) 2) 32)
:w 64 :h 64
:d :s
:sprite
{:image (.getElementById js/document "demo-player")
:size 64
:rows {:w 1 :e 3
:n 0 :s 2
:? 2}
:cycle {:pos 0
:from 1
:count 8
:last-cycle 0
;; seconds per cycle
:spc 0.08}}}
:viewport {:image (.getElementById js/document "demo-background")
:keep-in {:x 0 :y 0
:w 2239 :h 2235}
:x 1 :y 1
:d :?
;; pixels per second
:pps 350
:w (get-in gamestate [:dimensions :w])
:h (get-in gamestate [:dimensions :h])}}))
(defn update-player [gamestate player dir]
(let [old-dir (:d player)
@ -54,7 +52,7 @@
(let [player (:player scenestate)
viewport (:viewport scenestate)
dir (get-in gamestate [:input :dir])]
(assoc scenedata
(assoc scenestate
:player (update-player gamestate player dir)
:viewport (update-viewport gamestate viewport dir))))

Loading…
Cancel
Save