Skip to content

Commit

Permalink
FIX: Tile loading
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaro-cuesta committed Jun 9, 2012
1 parent dfa742b commit 12985f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/clojoban/core.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(ns clojoban.core
"A little Sokoban clone for \"Create a User-Profile Mini-Game\" at http://codegolf.stackexchange.com"
(:use [clojoban.game.model :only [add-levels]]
[clojoban.game controller view]
[clojoban.images :only [add-images]]
[clojoban.game view controller]
[clojoban.images :only [images add-images]]
[ring.adapter.jetty :only [run-jetty]]
[ring.middleware session stacktrace]
[ring.util response io])
Expand Down Expand Up @@ -48,7 +48,8 @@
"Bootstraps the needed data to start the server."
([level-dir theme-dir]
(add-levels level-dir)
(add-images theme-dir))
(add-images theme-dir)
(add-tiles images))
([] (boot "resources/levels" "resources/images")))

(defn -main
Expand Down
25 changes: 14 additions & 11 deletions src/clojoban/game/view.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@
(def tile-size
16)

(def tiles
{; Map
:wall (images "wall.png")
:floor (images "floor.png")
; Entities
:player-up (images "player-up.png")
:player-down (images "player-down.png")
:player-left (images "player-left.png")
:player-right (images "player-right.png")
:goal (images "goal.png")
:box (images "box.png")})
(def tiles (ref {}))

(defn add-tiles [images]
(dosync (ref-set tiles
{; Map
:wall (images "wall.png")
:floor (images "floor.png")
; Entities
:player-up (images "player-up.png")
:player-down (images "player-down.png")
:player-left (images "player-left.png")
:player-right (images "player-right.png")
:goal (images "goal.png")
:box (images "box.png")})))

;;; PRIVATES
(defn- draw-game [g {:keys [width height layout player boxes goals]} last-direction]
Expand Down

0 comments on commit 12985f2

Please sign in to comment.