Skip to content

Instantly share code, notes, and snippets.

View oakes's full-sized avatar

Zach Oakes oakes

View GitHub Profile
@oakes
oakes / core.clj
Last active July 15, 2017 06:13
Standalone Nightmod Template
(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]))
@oakes
oakes / core.clj
Created May 27, 2014 19:03
3D Physics
(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)))
@oakes
oakes / core.clj
Last active August 29, 2015 14:01
2D Physics
(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))