Use (game :x) and (game :y) again
This commit is contained in:
16
TUTORIAL.md
16
TUTORIAL.md
@@ -117,13 +117,13 @@ The [game](http://oakes.github.io/play-clj/core.game.html) function gives you co
|
|||||||
:on-touch-down
|
:on-touch-down
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(cond
|
(cond
|
||||||
(> (game :point-y) (* (game :height) (/ 2 3)))
|
(> (game :y) (* (game :height) (/ 2 3)))
|
||||||
(println "up")
|
(println "up")
|
||||||
(< (game :point-y) (/ (game :height) 3))
|
(< (game :y) (/ (game :height) 3))
|
||||||
(println "down")
|
(println "down")
|
||||||
(> (game :point-x) (* (game :width) (/ 2 3)))
|
(> (game :x) (* (game :width) (/ 2 3)))
|
||||||
(println "right")
|
(println "right")
|
||||||
(< (game :point-x) (/ (game :width) 3))
|
(< (game :x) (/ (game :width) 3))
|
||||||
(println "left")))
|
(println "left")))
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -162,13 +162,13 @@ Now we can update our `:on-key-down` and `:on-touch-down` functions to move the
|
|||||||
:on-touch-down
|
:on-touch-down
|
||||||
(fn [screen entities]
|
(fn [screen entities]
|
||||||
(cond
|
(cond
|
||||||
(> (game :point-y) (* (game :height) (/ 2 3)))
|
(> (game :y) (* (game :height) (/ 2 3)))
|
||||||
(move (first entities) :up)
|
(move (first entities) :up)
|
||||||
(< (game :point-y) (/ (game :height) 3))
|
(< (game :y) (/ (game :height) 3))
|
||||||
(move (first entities) :down)
|
(move (first entities) :down)
|
||||||
(> (game :point-x) (* (game :width) (/ 2 3)))
|
(> (game :x) (* (game :width) (/ 2 3)))
|
||||||
(move (first entities) :right)
|
(move (first entities) :right)
|
||||||
(< (game :point-x) (/ (game :width) 3))
|
(< (game :x) (/ (game :width) 3))
|
||||||
(move (first entities) :left)))
|
(move (first entities) :left)))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user