Skip to content

Instantly share code, notes, and snippets.

View nasser's full-sized avatar
🛰️
save-lisp-and-die

Ramsey Nasser nasser

🛰️
save-lisp-and-die
View GitHub Profile
%!PS
/Helvetica findfont 9 scalefont setfont
/printBeer {
dup
20 string cvs show
( bottle) show
1 ne
{ (s) show } if
( of beer) show
/Applications/Unity/Unity.app/Contents/Frameworks/MonoBleedingEdge/bin/mono /Applications/Unity/Unity.app/Contents/Frameworks/MonoBleedingEdge/lib/mono/2.0/xbuild.exe build.proj /target:"Dist" /p:Runtime="Mono" /p:Configuration="Debug 3.5" /p:Platform="Any CPU"
/*
each of your game states can inherit from ofBaseApp if you're just
overriding update and draw and the like. this is the simplest thing
you can do and that's the example included here. other states besides
MenuState can be implemented in the same way.
more generally and more powerfully, you could create a GameState class
that all of your states inherit from. there, you would define methods
to override like update and draw, but also methods to handle switching
between states that each state can override. this requires an understanding
pos = x:20, y:20
setup = ->
createCanvas w:800, h:800
# square animation
timeline -> pos.x += 1 >= width - 50
timeline -> pos.y += 1 >= height - 50
timeline -> pos.x -= 1 <= 20
timeline -> pos.y -= 1 <= 20
(ns PlainClojureShit
(:import
(UnityEngine Debug)
(UnityEditor EditorGUILayout)))
(def happy (atom true)) ;; Multiple instances of this component will SHARE this atom! They should each have their OWN atom!
(defn start [this]
(Debug/Log "PlainClojureShit is starting"))
function Update () {
if(Input.GetKeyDown("space")) {
GetComponent(WeirdGravity).gravity.y = 30;
}
}
@nasser
nasser / 1-brownian.pde
Last active August 29, 2015 14:01
Stack Syntax Sketch
int num = 2000;
int range = 6;
float[] ax = new float[num];
float[] ay = new float[num];
void setup()
{
function namedArgs(fn) {
var names = fn.toString().match(/function.*\(([^\)]+)\)/)[1].split(',');
return eval("(function(args) {\
return fn(" + names.map(function(n) { return "args[\"" + n.trim() + "\"]"}).join() + ");\
})");
}
void Start () {
InvokeRepeating ("NewTarget", 3, 3);
}
void NewTarget() {
target = GameObject.FindGameObjectsWithTag ("Enemy").Where(go => go.transform.position.z > 5).Shuffle ().FirstOrDefault ();
}
(defn start []
(invoke-repeating new-target 3 3))
(defn new-target []
(set! target (->> (unity/find :tag "Enemy") (filter #(> (.. % transform position z) 5)) (shuffle) (first)))