Created
June 18, 2015 21:33
-
-
Save timsgardner/968a260102cc0e747a7f to your computer and use it in GitHub Desktop.
a fun-tastic game u kids
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 wall-jiggle.wall-jiggle | |
(:use arcadia.core | |
arcadia.linear) | |
(:require [arcadia.updater :as updr]) | |
(:import [UnityEngine Transform])) | |
(defscn wall | |
(let [top (GameObject. "wall")] | |
(dotimes [x 10] | |
(dotimes [y 10] | |
(let [c (create-primitive :cube)] | |
(set! (.localPosition (.GetComponent c Transform)) | |
(v3 x y 0)) | |
(set-parent c top)))) | |
top)) | |
(def counter (atom 0)) | |
(defn jiggle-wall [] | |
(swap! counter inc) | |
(.Translate (.GetComponent wall Transform) | |
(v3 | |
(- (rand 2) 1) | |
(- (rand 2) 1) | |
(- (rand 2) 1)))) | |
(def camera | |
(object-named "Main Camera")) | |
(defn look-at-wall [] | |
(let [tr (.GetComponent camera Transform)] | |
(set! (.rotation tr) | |
(qlookat | |
(.position tr) | |
(.position (.GetComponent wall Transform)))))) | |
(defn jiggle-logic [] | |
(jiggle-wall) | |
(look-at-wall)) | |
;; should be put! rather than put | |
(updr/put ::jiggle-logic #'jiggle-logic) | |
(defcomponent Setup [] | |
(Awake [_])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment