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 :w])
(get-in gamestate [:dimensions :h])) (get-in gamestate [:dimensions :h]))
(let [scenekey (:scene gamestate) (let [scenekey (:scene gamestate)
drawfunc (get-in gamestate [:scenes scenekey :draw])] scene (get-in gamestate [:scenes scenekey])
drawfunc (:draw scene)]
(drawfunc gamestate scene)) (drawfunc gamestate scene))
(draw-fps gamestate)) (draw-fps gamestate))

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

Loading…
Cancel
Save