From faeccbecde80663fff99f9a9bb31c9324617938c Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Wed, 24 Oct 2018 15:16:00 +0200 Subject: [PATCH] player position --- src/cljs/topdown2d/demoscene.cljs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cljs/topdown2d/demoscene.cljs b/src/cljs/topdown2d/demoscene.cljs index 09ad5b3..2f24085 100644 --- a/src/cljs/topdown2d/demoscene.cljs +++ b/src/cljs/topdown2d/demoscene.cljs @@ -17,8 +17,8 @@ {:map-def {:images {:pokelike (by-id "demoscene-tileset")} :def nil :zoom 3} - :player {:x (- (/ (get-in gamestate [:dimensions :w]) 2) 32) - :y (- (/ (get-in gamestate [:dimensions :h]) 2) 32) + :player {:x (/ (get-in gamestate [:dimensions :w]) 2) + :y (/ (get-in gamestate [:dimensions :h]) 2) :w 0 :h 0 :d :s :animation {:ids {:s 778 :n 778 @@ -67,7 +67,9 @@ (update-in [:viewport :x] * tw zoom) (update-in [:viewport :y] * th zoom) (assoc-in [:player :w] (- tw 2)) - (assoc-in [:player :h] (- th 2)))) + (assoc-in [:player :h] (- th 2)) + (update-in [:player :w] - (/ tw 2)) + (update-in [:player :h] - (/ th 2)))) scenestate)) (defn update-scene [gamestate scenestate]