This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my-game.core | |
(:require [clojure.edn :as edn] | |
[clojure.java.io :as io] | |
[play-clj.core :refer :all] | |
[play-clj.g2d :refer :all] | |
[play-clj.g3d :refer :all] | |
[play-clj.math :refer :all] | |
[play-clj.physics :refer :all] | |
[play-clj.ui :refer :all]) | |
(:import [java.io StringWriter])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(print "Click the screen to create a new block.") | |
(def ^:const mass 10) | |
(defn get-environment | |
[] | |
(let [attr-type (attribute-type :color :ambient-light) | |
attr (attribute :color attr-type 0.3 0.3 0.3 1)] | |
(environment :set attr))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def ^:const pixels-per-tile 32) | |
(defn create-ball-body! | |
[screen radius] | |
(let [body (add-body! screen (body-def :dynamic))] | |
(->> (circle-shape :set-radius radius) | |
(fixture-def :density 1 :friction 0 :restitution 1 :shape) | |
(body! body :create-fixture)) | |
body)) |
NewerOlder