Created
February 28, 2012 02:34
-
-
Save Jared314/1928789 to your computer and use it in GitHub Desktop.
Z-Type Game Clojure.Core Custom Dictionary
This file contains hidden or 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
//Run this while at the main menu | |
ig.game.registerTarget=function(letter,ent){if(this.targets[letter]===undefined)this.targets[letter]=[];this.targets[letter].push(ent);}; | |
ig.game.unregisterTarget=function(letter,ent){(this.targets[letter]||[]).erase(ent);}; | |
window.removeEventListener('keydown',ig.game.keydown.bind(ig.game)); | |
ig.game.keydown=function (event){if(event.target.type=='text'||event.ctrlKey||event.altKey||this.mode!=ZType.MODE.GAME||this.menu){return true;}var c=event.which;if(c==189)c=45;if(event.shiftKey&&c==191)c=63;if(event.shiftKey&&c==56)c=42;if(event.shiftKey&&c==49)c=33;if(c==187)c=61;if(!((c>64&&c<91)||(c>96&&c<123)||(c==45||c==33||c==63||c==42||c==61))||c==16){return true;} event.stopPropagation();event.preventDefault();var letter=String.fromCharCode(c).toLowerCase();if(!this.currentTarget){var potentialTargets=this.targets[letter];var nearestDistance=-1;var nearestTarget=null;for(var i=0;i<potentialTargets.length;i++){var distance=this.player.distanceTo(potentialTargets[i]);if(distance<nearestDistance||!nearestTarget){nearestDistance=distance;nearestTarget=potentialTargets[i];}} if(nearestTarget){nearestTarget.target();}else{this.player.miss();this.multiplier=1;this.streak=0;this.misses++;}}if(this.currentTarget){var c=this.currentTarget;var hit=this.currentTarget.isHitBy(letter);if(hit){this.player.shoot(c);this.score+=this.multiplier;this.hits++;this.streak++;if(ZType.MULTIPLIER_TIERS[this.streak]){this.multiplier+=1;} if(c.dead){this.kills++;}}else{this.player.miss();this.multiplier=1;this.streak=0;this.misses++;}} return false;} | |
window.addEventListener('keydown',ig.game.keydown.bind(ig.game),true); | |
WORDS={2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[],11:[],12:[]}; | |
var w = 'accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char chars class class clear-agent-errors clojure-version coll comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter find find-keyword find-ns find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat max max-key memfn memoize merge merge-with meta methods min min-key mod name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers print print-str printf println println-str prn prn-str promise proxy proxy-mappings proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap' | |
.toLowerCase().split(' '); | |
for (var i = w.length - 1; i >= 0; i--) { if(w[i].length < 13 && w[i].length > 1) WORDS[w[i].length].push(w[i]); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment