Added game over notification

master
Abhinav Sarkar 9 years ago
parent daae81a751
commit 7a9712061d
  1. 2
      resources/public/index.html
  2. 5
      src/cljs/frpong/core.cljs

@ -50,7 +50,7 @@ body {
<span style="float: left; vertical-align: top;">Gravity
<input id="gravity" type="range" min="1" max="10" value="1" step="1" />
</span>
<span style="float: right; font-size: small">
<span style="float: right; font-size: smaller">
<span id="state">press &lt;space&gt; to start</span>
</span>
</div>

@ -311,9 +311,11 @@
score-el (dom/by-id "score")
lpaddle-el (dom/by-id "lpaddle")
rpaddle-el (dom/by-id "rpaddle")
fps-el (dom/by-id "fps")]
fps-el (dom/by-id "fps")
title-el (dom/by-id "title")]
(dom/set-style! ball-el "fill" "orange")
(dom/set-text! state-el "")
(dom/set-text! title-el "Gravity Pong!")
(go (loop [fps-p nil score-p nil]
(let [fps (int (/ 1000 (<! ticks)))
[x y] (<! pos)
@ -331,6 +333,7 @@
(when (= state :gameover)
(do (dom/set-style! ball-el "fill" "red")
(dom/set-text! state-el "press <space> to restart")
(dom/set-text! title-el "GAME OVER")
(start-on-space)))
(recur fps score))))))

Loading…
Cancel
Save