fixed the max gravity
This commit is contained in:
parent
e023942ac2
commit
932b69a234
@ -61,7 +61,7 @@ body {
|
|||||||
<center>
|
<center>
|
||||||
<div id="screen">
|
<div id="screen">
|
||||||
<h2 id="title">Gravity Pong!</h2>
|
<h2 id="title">Gravity Pong!</h2>
|
||||||
<div id="msg"></div>
|
<div id="msg">press <space> to start</div>
|
||||||
<svg id="canvas">
|
<svg id="canvas">
|
||||||
<circle id="mass" />
|
<circle id="mass" />
|
||||||
<text id="score">0</text>
|
<text id="score">0</text>
|
||||||
@ -75,7 +75,7 @@ body {
|
|||||||
</div>
|
</div>
|
||||||
use W-S and Up-Down keys to move the paddles / use Left-Right keys to change gravity
|
use W-S and Up-Down keys to move the paddles / use Left-Right keys to change gravity
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<a target="_blank" href="https://github.com/abhin4v/frpong">Source</a>
|
<a target="_blank" href="http://github.com/abhin4v/frpong">github</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
(go-loop
|
(go-loop
|
||||||
(let [k (:keyCode (<! keydowns))]
|
(let [k (:keyCode (<! keydowns))]
|
||||||
(when (contains? actions k)
|
(when (contains? actions k)
|
||||||
(do (swap! *gravity* #(max 0 (min 10 ((actions k) %))))
|
(do (swap! *gravity* #(max 0 (min 0.1 ((actions k) %))))
|
||||||
(dom/set-attr! (dom/by-id "mass") "r" (mass-radius))))))))
|
(dom/set-attr! (dom/by-id "mass") "r" (mass-radius))))))))
|
||||||
|
|
||||||
(defn layout-game
|
(defn layout-game
|
||||||
@ -356,5 +356,4 @@
|
|||||||
(defn ^:export frpong []
|
(defn ^:export frpong []
|
||||||
(setup-gravity-control)
|
(setup-gravity-control)
|
||||||
(layout-game)
|
(layout-game)
|
||||||
(dom/set-text! (dom/by-id "msg") "press <space> to start")
|
|
||||||
(start-on-space))
|
(start-on-space))
|
||||||
|
Loading…
Reference in New Issue
Block a user