+++ /dev/null
-(function(){
-
-this.Y = Y;
-
-var globals = this
+var undefined
+, globals = (function(){ return this; })()
, _Object = globals.Object
, _Function = globals.Function
, _Array = globals.Array
, _Number = globals.Number
, slice = _Array.prototype.slice
-, toString = _Object.prototype.toString
, hasOwn = _Object.prototype.hasOwnProperty
, getProto = _Object.getPrototypeOf
;
// Inspired by John Resig's "Simple Class Inheritence" -- http://ejohn.org/blog/simple-javascript-inheritance/
-var KNOWN_CLASSES = {}
+var Y = require('Y').Y
+, type = require('Y/type')
+, KNOWN_CLASSES = type.type.KNOWN_CLASSES
, classToString = function toString(){ return this.className+"()"; }
;
, instance = this;
// Not subclassing
- if ( cls.caller !== Y.Class.fabricate ) {
+ if ( cls.caller !== Class.fabricate ) {
if ( instance.init ){
var result = instance.init.apply(instance, arguments);
if (result) instance = result;
prototype[k] = members[k];
}
- if (prototype.init) NewClass.init = prototype.init;
+ if (prototype.init) NewClass.init = Y(prototype.init);
KNOWN_CLASSES[className] = NewClass;
Class.className = Class.fn.className = "Class";
-Y.Class =
-Y.subclass = Class;
-
/* Class Methods */
/**
/**
* Root-class for all Y-objects.
*/
-function YBase(){}
-YBase = Y.YBase = new Class("YBase", {
+var YBase = new Class("YBase", {
__y__ : true
});
function bindName(v, k){
if ( isFunction(v) )
- this[k] = Y(this[k]).bind(this);
+ this[k] = Y(v).bind(this);
}
// bindName = Y(bindName).curry();
-Y.bindAll = bindAll;
function bindAll(o, names){
var names = new Y(arguments, 1);
Y(names.size() ? names.generate(Y.op.get(o)) : o).forEach( bindName, o );
-
- // if ( names.size() ){
- // names.forEach(binder);
- // } else
- // for (var k in o) binder(k);
-
return o;
}
return o;
}
+exports['Class'] =
+exports['subclass'] = Class;
+exports['instantiate'] = Class.instantiate.bind(Class);
+exports['fabricate'] = Class.fabricate.bind(Class);
+
+exports['YBase'] = YBase;
+exports['bindAll'] = bindAll;
+exports['chainDelegates'] = chainDelegates;
+exports['mixinNames'] = mixinNames;
function forEach(o, fn){
map(o, fn, cxt);
+ return o;
}
function filter(o, fn){
}
function extend( A, B ){
- return slice.call(arguments,1).reduce(extend._extendall, A);
+ return slice.call(arguments,1).reduce(extendall, A);
+}
+function extendall(A, donor){ return reduce(donor, attrvk, A); }
+function attrvk(o, v, k){ return attr(o, k, v, o[k]); }
+
+function dextend( A, B ){
+ return slice.call(arguments,1).reduce(dextendall, A);
}
-extend._extendall = function _extendall(A, donor){
- return reduce(donor, extend._set, A);
-};
-extend._set = function _set(o, v, k){
- return dattr(o, k, v, o[k]);
-};
+function dextendall(A, donor){ return reduce(donor, dattrvk, A); }
+function dattrvk(o, v, k){ return dattr(o, k, v, o[k]); }
+
+
+exports['reduce'] = reduce;
+exports['map'] = map;
+exports['forEach'] = forEach;
+exports['filter'] = filter;
+
+exports['set'] = set;
+exports['attr'] = attr;
+exports['extend'] = extend;
+exports['dset'] = dset;
+exports['dattr'] = dattr;
+exports['dextend'] = dextend;
--- /dev/null
+
+/// Import our external deps first ///
+require('lessly/future');
+require('functional/to-function');
+
+/// Set up core and utilities ///
+var core = require('Y/core')
+, type = require('Y/type')
+, Y = require('Y/y').Y
+;
+
+exports['Y'] = Y;
+
+// Copy all our type utils onto the type function, as it has the
+// same name as its namespace
+core.extend(type.type, type);
+
+// Attach core & type to Y
+core.extend(Y, core, type);
+
+// Make top-level setters refer to the delegating versions
+Y['core'] = core;
+Y['set'] = core.dset;
+Y['attr'] = core.dattr;
+Y['extend'] = core.dextend;
+
+
+/// Patch modules that weren't available earlier ///
+
+// Attach YFunction methods to library functions
+var yfn = require('Y/types/function')
+, YFunction = Y['YFunction'] = yfn.YFunction ;
+
+YFunction(Y);
+core.forEach(core, YFunction);
+YFunction(Y.type);
+Y['is'] = YFunction(Y.is).curry();
+
+addNames('curry methodize genericize compose chain memoize', yfn);
+
+// Curry all operators
+var op = require('Y/op');
+core.forEach(op, YFunction);
+Y['op'] = op.extend({}, core.map(yfn.curry, op));
+// Y['op'] = core.reduce(op, function(Yop, fn, k){
+// Yop[k] = yfn.curry(fn);
+// return Yop;
+// }, {});
+
+// var yclass = require('Y/types/class');
+addNames('Class subclass instantiate fabricate YBase',
+ require('Y/class'));
+
+
+/// Now start assembling the normal sub-modules ///
+addNames('YCollection', require('Y/types/collection'));
+addNames('YArray', require('Y/types/array'));
+addNames('YObject', require('Y/types/object'));
+addNames('YString', require('Y/types/string'));
+addNames('YNumber range', require('Y/types/number'));
+
+// var ycollection = require('Y/types/collection')
+// , yarray = require('Y/types/array')
+// , yobject = require('Y/types/object')
+// , ystring = require('Y/types/string')
+// , ynumber = require('Y/types/number')
+// ;
+
+
+function addName(name){ Y[name] = this[name]; }
+function addNames(names, ns){ names.split(' ').forEach(addName, ns); }
-
/* A subset of the functional operators, used in Y's core */
-Y.op = {
+
+var Y = require('Y').Y
+, core = require('Y/core')
+, op = { // XXX: Make these function statements?
// comparison
cmp: function(x,y){ return x == y ? 0 : (x > y ? 1 : -1); },
has: function(o,k){ return k in o; },
get: function(o,k){ return o[k] },
getdef: function(o,k,def){ return (k in o ? o[k] : def); },
- set: set, // set( o, key, value, def )
- attr: attr, // attr( o, key, value, def )
+ set: core.set, // set( o, key, value, def )
+ attr: core.attr, // attr( o, key, value, def )
method: function(name){
var args = Y(arguments,1);
return function(obj){
};
},
extend : function extend(A,B){
- return slice.call(arguments,1).reduce('A donor -> Y.reduce(donor, Y.op.vkset, A)'.lambda(), A);
+ return slice.call(arguments,1).reduce(extender, A);
}
};
+function extender(target, donor){
+ return core.reduce(donor, op.vkset, target);
+}
-// Curry all operators
-Y.op = Y.reduce(Y.op, function(op, fn, k){
- op[k] = Y( Y(fn).curry() );
- return op;
-}, {});
-
+core.extend(exports, op);
// Type Utilities //
// Much borrowed from jQuery
+var undefined
+, globals = (function(){ return this; })()
+, _Object = globals.Object
+, _Function = globals.Function
+, _Array = globals.Array
+, _String = globals.String
+, _Number = globals.Number
+
+, FN = "constructor"
+, PT = "prototype"
+, OP = _Object[PT]
+
+, slice = _Array[PT].slice
+, getProto = _Object.getPrototypeOf
+, hasOwn = OP.hasOwnProperty
+, toString = OP.toString
+, hasOwn = OP.hasOwnProperty
+
+, KNOWN_CLASSES = {}
+;
+
var class2name =
"Boolean Number String Function Array Date RegExp Object"
.split(" ")
.reduce(function(class2name, name) {
class2name[ "[object "+name+"]" ] = name.toLowerCase();
return class2name;
- }, {})
-;
+ }, {});
function type_of(obj){
return obj == null ?
class2name[ toString.call(obj) ] || "object";
}
+isArray.types = [];
function isArray(obj) { return type_of(obj) === "array" || obj instanceof Y.YArray; }
function isFunction(obj) { return type_of(obj) === "function"; }
function isString(obj) { return type_of(obj) === "string"; }
return false;
// Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") )
+ if ( obj[FN] &&
+ !hasOwn.call(obj, FN) &&
+ !hasOwn.call(obj[FN][PT], "isPrototypeOf") )
return false;
function type( o ) {
switch ( typeof(o) ) {
case "undefined" : return undefined;
- case "string" : return String;
- case "number" : return Number; // Note: NaN and Infinity are Number literals
- case "boolean" : return Boolean;
+ case "string" : return _String;
+ case "number" : return _Number; // Note: NaN and Infinity are Number literals
+ case "boolean" : return _Boolean;
case "function" :
// If the function has a user-specified prototype, we can probably assume
// it's meant to be a class constructor (and therefore, a type)
- if ( o.prototype && o.prototype !== Function.prototype )
+ if ( o[PT] && o[PT] !== _Function[PT] )
return o;
else
- return Function;
+ return _Function;
case "object" :
default :
return null;
return KNOWN_CLASSES[o.className] || o.__class__
- || (o.constructor && o.constructor !== Object) ? o.constructor : Object;
+ || (o[FN] && o[FN] !== _Object) ? o[FN] : _Object;
}
}
return (A instanceof BT || B instanceof AT || AT === BT);
}
}
+
+exports['is'] = is;
+exports['type'] = type;
+exports['type_of'] = type_of;
+
+exports['isArray'] = isArray;
+exports['isFunction'] = isFunction;
+exports['isString'] = isString;
+exports['isNumber'] = isNumber;
+exports['isWindow'] = isWindow;
+exports['isPlainObject'] = isPlainObject;
+
+type['KNOWN_CLASSES'] = KNOWN_CLASSES;
+
-var
-YArray =
-Y.YArray =
-YCollection.subclass('YArray', function(YArray){
+var Y = require('Y').Y;
+
+exports['YArray'] =
+Y.YCollection.subclass('YArray', function(YArray){
+ var yclass = require('Y/class');
+
+ yclass.chainDelegates(YArray, 'push', 'unshift', 'sort', 'splice', 'reverse');
+ yclass.mixinNames(YArray, Array, ['reduce', 'map', 'forEach', 'filter', 'slice', 'some', 'every'], true, true);
+ yclass.mixinNames(YArray, Array, ['indexOf', 'lastIndexOf', 'shift', 'pop', 'join'], true, false);
+
+
+
+
this.init = function(o){
// YCollection.init.call(this, o || []);
this._o = o || [];
function concat( donor ){
var A = this._o;
new Y(arguments).forEach(function( donor ){
- A = A.concat(donor instanceof Y.YArray ? donor.end() : donor);
+ A = A.concat(donor instanceof YArray ? donor.end() : donor);
});
return Y(A);
};
acc.push(v);
return acc;
- }, new Y.YArray() );
+ }, new YArray() );
// return this.filter(function(v, i){
// // Executes in the context of the new array, so
return "Y[" + (this._o || "") + "]";
};
-
- chainDelegates(YArray, 'push', 'unshift', 'sort', 'splice', 'reverse');
- mixinNames(YArray, Array, ['reduce', 'map', 'forEach', 'filter', 'slice', 'some', 'every'], true, true);
- mixinNames(YArray, Array, ['indexOf', 'lastIndexOf', 'shift', 'pop', 'join'], true, false);
-
return this;
});
-
/** YCollection is the core of Y. */
-function bool(v){ return !!(v); }
+var Y = require('Y').Y
+, isFunction = require('Y/type').isFunction
+, extend = require('Y/core').extend
+, bool = require('Y/op').bool
+;
+
function extendY(){
- extend.apply(this, [this._o].concat(Y(arguments)) );
+ extend.apply(this, [this._o].concat(Y(arguments)));
return this;
}
-var
-YCollection =
-Y.YCollection =
-YBase.subclass('YCollection', {
+exports['YCollection'] =
+Y.YBase.subclass('YCollection', {
'init' : function(o){
- if (!o) return;
- this._o = o;
+ this._o = o || {};
},
'attr' : function attr(k, v, def){
-var _ = globals._ = Y._ = YFunction._ = {}
-, WRAPS = "__wraps__"
+var undefined
+, WRAPS = "__wraps__"
+, globals = (function(){ return this; })()
+
+, Y = require('Y').Y
+, core = require('Y/core')
+, type = require('Y/type')
+
+, isNumber = type.isNumber
+, isFunction = type.isFunction
+, isArray = type.isArray
+, isPlainObject = type.isPlainObject
+
+, _ = exports._ = YFunction._ = {}
+, YFP = YFunction.prototype
;
function YFunction(fn){
- if (!fn)
- fn = function(){};
+ fn = fn || function(){};
if (fn.__y__)
return fn;
fn.__y__ = true;
- return Y.YFunction.install(fn);
+
+ for (var k in YFP) {
+ var v = YFP[k];
+ if ( isFunction(v) && (k == 'bind' || !fn[k]) )
+ fn[k] = v;
+ }
+ return fn;
}
-Y.YFunction = YFunction;
-Y.extend(YFunction.prototype, {
+core.extend( YFP, {
init : YFunction,
- reduce : methodize(Y.reduce),
- extend : methodize(Y.extend),
- end : function end(){ return this; }
+ attr : methodize(core.attr),
+ reduce : methodize(core.reduce),
+ extend : methodize(core.extend),
+ end : function end(){ return this; }
});
-YFunction.prototype.attr = methodize(Y.attr);
-YFunction.install =
-function install(target){
- target = target || Function.prototype;
- var proto = Y.YFunction.prototype;
-
- for (var k in proto) {
- if ( Y.isFunction(proto[k]) && (k == 'bind' || !target[k]) )
- target[k] = proto[k];
- }
- return target;
-};
return ( fn && isFunction(fn) ) ? unwrap(fn[WRAPS]) || fn : fn;
}
-Y.curry = curry;
-YFunction.prototype.curry = methodize(curry);
function curry(fn){
if (fn.__curried__)
return fn.apply(this, Y(arguments,1));
}
-Y.methodize = methodize;
-YFunction.prototype.methodize = methodize(methodize);
function methodize(fn) {
fn = fn.toFunction();
var g = fn.__genericized__
return m;
}
-Y.genericize = genericize;
-YFunction.prototype.genericize = methodize(genericize); // heh
function genericize( fn ) {
fn = fn.toFunction();
var g = fn.__genericized__
-Y.compose = compose;
-YFunction.prototype.compose = methodize(compose);
function _composer(x,fn){ return fn.call(this, x); }
function compose(f,g){
var fns = Y(arguments).map(Function.toFunction);
};
}
-Y.chain = chain;
-YFunction.prototype.chain = methodize(chain);
function chain(f,g){
var fns = Y(arguments).map(Function.toFunction);
// }
-function splat(fn, x){
- return fn[ isArray(x) ? "apply" : "call"](this, x);
-}
-
var _bind = _Function.prototype.bind;
-YFunction.prototype.bind =
- function bind(context, args){
- var bound = _bind.apply(this, arguments);
- bound[WRAPS] = this;
- return Y(bound);
- };
+function bind(fn, context, args){
+ var bound = _bind.apply(fn, Y(arguments,1));
+ bound[WRAPS] = fn;
+ return YFunction(bound);
+}
// Remembers arguments but obeys current context
-YFunction.prototype.partial =
- function partial(){
- var fn = this
- , args = Y(arguments)
- , partially = function(){
- return fn.apply( this, args.concat(Y(arguments)) );
- };
- partially[WRAPS] = fn;
- return Y(partially);
- };
+function partial(fn){
+ var args = Y(arguments,1)
+ , partially =
+ function partially(){
+ return fn.apply( this, args.concat(Y(arguments)) );
+ };
+ partially[WRAPS] = fn;
+ return YFunction(partially);
+}
// Only works for arguments whose toString is unique and stateless (for example, primitives, but not closures).
// XXX: hashCode()
-Y.memoize = memoize;
-YFunction.prototype.memoize = methodize(memoize);
/**
* @param {Function} fn Function to memorize.
'); }; })');
});
-YFunction.prototype.aritize =
-function aritize(n){
- var fn = this
- , cache = fn.__aritized__ ;
+function aritize(fn, n){
+ var cache = fn.__aritized__ ;
if (fn.length === n)
return fn;
return cache[n];
return ( cache[n] = _ofArityWrapper(n, false)(fn) );
-};
+}
-YFunction.prototype.limit =
-function limit(n){
- var fn = this
- , cache = fn.__limited__ ;
+function limit(fn, n){
+ var cache = fn.__limited__ ;
if ( !cache )
cache = fn.__limited__ = {};
return cache[n];
return ( cache[n] = _ofArityWrapper(n, true)(fn) );
-};
+}
/**
/** Returns the declared name of a function. */
-YFunction.prototype.getName = Y.getName
- function getName( fn ){
- if ( !fn && isFunction(this) )
- fn = this;
- if ( !isFunction(fn) )
- return fn;
- else
- return fn.className || fn.name || (fn+'').match( /function\s*([^\(]*)\(/ )[1] || '';
- }
+function getName( fn ){
+ if ( !isFunction(fn) )
+ return fn;
+ else
+ return fn.className || fn.name || (fn+'').match( /function\s*([^\(]*)\(/ )[1] || '';
+}
+function splat(fn, x){
+ return fn[ isArray(x) ? "apply" : "call"](this, x);
+}
-YFunction(Y);
-Y(Y.reduce);
-Y(Y.map);
-Y(Y.forEach);
-Y(Y.filter);
-Y(Y.set);
-Y(Y.attr);
-Y(Y.extend);
-Y(Y.type);
-Y.is = Y(Y.is).curry();
-Y.reduce(YFunction.prototype, function(_,fn,name){
- YFunction(fn);
-});
+
+
+exports['unwrap'] = unwrap;
+exports['curry'] = curry;
+exports['methodize'] = methodize;
+exports['genericize'] = genericize;
+exports['compose'] = compose;
+exports['chain'] = chain;
+exports['bind'] = bind;
+exports['partial'] = partial;
+exports['memoize'] = memoize;
+exports['aritize'] = aritize;
+exports['limit'] = limit;
+exports['getName'] = getName;
+// exports['splat'] = splat;
+
+// Methodize and then attach to YFunction's prototype
+YFP.extend(core.map(exports, methodize));
+// YFP['unwrap'] = methodize(unwrap);
+// YFP['curry'] = methodize(curry);
+// YFP['methodize'] = methodize(methodize);
+// YFP['genericize'] = methodize(genericize); // heh
+// YFP['compose'] = methodize(compose);
+// YFP['chain'] = methodize(chain);
+// YFP['bind'] = methodize(bind);
+// YFP['partial'] = methodize(partial);
+// YFP['memoize'] = methodize(memoize);
+// YFP['aritize'] = methodize(aritize);
+// YFP['limit'] = methodize(limit);
+// YFP['getName'] = methodize(getName);
+
+// Export these last to avoid methodizing them
+exports['YFunction'] = YFunction;
+
+// Attach our methods to our exports!
+core.forEach(exports, YFunction);
+var Y = require('Y').Y
+, op = require('Y/op')
+;
-var
-YNumber =
-Y.YNumber =
-YCollection.subclass('YNumber', {
- init: function(o){
- if (!o) o = 0;
- YCollection.init.call(this, o);
- },
-
- compare : function compare(n){
- var m = this._o;
- return (m > n ? 1 :
- (m < n ? -1 : 0 ));
- },
-
- toString : function toString(){
- return this.end()+'';
- }
-});
-
-
-Y.range = range;
function range(start, end, step){
switch (arguments.length) {
// range() -> []
return r;
}
+
+exports['YNumber'] =
+Y.YCollection.subclass('YNumber', {
+ init: function(o){
+ this._o = o || 0;
+ },
+
+ compare : function compare(n){
+ return op.cmp(this._o, n);
+ },
+
+ range : function range(end, step){
+ return range(this._o, end, step);
+ },
+
+ toString : function toString(){
+ return this.end()+'';
+ }
+});
+
+exports['range'] = range;
+var Y = require('Y').Y
+, isArray = Y.isArray
+;
-var
-YObject =
-Y.YObject =
-YCollection.subclass('YObject', {
+
+exports['YObject'] =
+Y.YCollection.subclass('YObject', {
'init': function initYObject(o){
this._o = o || {};
+var Y = require('Y').Y
+, mixinNames = require('Y/class').mixinNames
+, op = require('Y/op')
+;
-var
-YString =
-Y.YString =
-YCollection.subclass('YString', function(YString){
+exports['YString'] =
+Y.YCollection.subclass('YString', function(YString){
mixinNames(YString, String, [
'slice', 'split',
return s;
}
- Y.op.extend(this, {
+ op.extend(this, {
init : function init(o){
if (!o) o = "";
this._o = o;
// TODO: Should cache the new properties and re-applied them whenever we mutate _o,
// as strings are immutable and they'll be lost otherwise.
- Y.op.set(s, key, _val);
+ op.set(s, key, _val);
return this;
};
+var undefined
+, globals = (function(){ return this; })()
+, _Object = globals.Object
+, _Function = globals.Function
+, _Array = globals.Array
+, _String = globals.String
+, _Number = globals.Number
-Y.reduce = reduce;
-Y.map = map;
-Y.forEach = forEach;
-Y.filter = filter;
-Y.set = dset;
-Y.attr = dattr;
-Y.extend = extend;
-
-Y.type = type;
-Y.is = is;
-Y.isString = isString;
-Y.isNumber = isNumber;
-Y.isFunction = isFunction;
-Y.isArray = isArray;
-Y.isPlainObject = isPlainObject;
+, FN = "constructor"
+, PT = "prototype"
+, OP = _Object[PT]
+, slice = _Array[PT].slice
+, getProto = _Object.getPrototypeOf
+, hasOwn = OP.hasOwnProperty
+, toString = OP.toString
+, hasOwn = OP.hasOwnProperty
+, core = require('Y/core')
+, extend = core.extend
+, type = require('Y/type')
+, type_of = type.type_of, isNumber = type.isNumber
+, isPlainObject = type.isPlainObject, isArray = type.isArray
+;
/**
* Creates a Y wrapper around its input.
}
// Do we have a type-specific wrapper?
- var name = type_of(o)
- , yname = 'Y' + name.charAt(0).toUpperCase() + name.slice(1)
+ var name = type_of(o)
+ , yname = 'Y' + name.charAt(0).toUpperCase() + name.slice(1)
, YType = Y[yname]
;
- // if ( YType && YType !== Y.YObject || YType !== Y.YBase )
- // return new YType(o);
if ( YType )
return new YType(o);
- // Add YFunction methods, since we can't subclass function
- // if ( isFunction(o) )
- // return new Y.YFunction(o);
-
// Finally, Generic object wrapper
return new Y.YObject(o);
}
+exports['Y'] = Y;
--- /dev/null
+// -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*-
+var defaults =
+exports.defaults = {
+ ui : {
+ showGridCoords : false,
+ showCountdown : true
+ },
+ pathing : {
+ overlayAIPaths : false,
+ overlayPathmap : false,
+ traceTrajectories : false
+ }
+};
+exports.values = Y(defaults).clone().end();
+++ /dev/null
-// -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*-
-tanks.config = {
- defaults : {
- ui : {
- showGridCoords : false,
- showCountdown : true
- },
- pathing : {
- overlayAIPaths : false,
- overlayPathmap : false,
- traceTrajectories : false
- }
- }
-};
-
-tanks.config.values = Y(tanks.config.defaults).clone().end();
\ No newline at end of file
-tanks.Game = Y.subclass('Game', {
+var tanks = require('tanks')
+, map = require('tanks/map')
+, thing = require('tanks/thing')
+, Grid = require('tanks/ui/grid').Grid
+
+, Level = map.Level
+, Thing = thing.Thing, Tank = thing.Tank, Bullet = thing.Bullet
+
+;
+
+exports.Game = Y.subclass('Game', {
overlayPathmap : false,
SECONDTH = ELAPSED / 1000;
SQUARETH = REF_SIZE * SECONDTH;
-}
+};
if (!window.console) {
console = {
--- /dev/null
+var tanks = exports.tanks = {};
+tanks.config = require('tanks/config');
+++ /dev/null
-tanks = {};
--- /dev/null
+exports.Thing = require('tanks/thing/thing').Thing;
+exports.Bullet = require('tanks/thing/bullet').Bullet;
+exports.Tank = require('tanks/thing/tank').Tank;
+exports.PlayerTank = require('tanks/thing/player').PlayerTank;
+
-(function(){
-PlayerTank = Tank.subclass('PlayerTank', {
+var PlayerTank =
+exports.PlayerTank =
+Tank.subclass('PlayerTank', {
+
bodyColor : '#E73075',
turretColor : '#A72F5B',
barrelColor : '#2E62C9',
}
};
-
-
-})();
-Thing = new Evt.Class('Thing', {
+var loc = require('tanks/map/loc')
+, Cooldown = require('ezl/loop/cooldown').Cooldown
+, Loc = loc.Loc, BoundingBox = loc.BoundingBox
+;
+
+var Thing =
+exports.Thing =
+new Evt.Class('Thing', {
init : function init(align){
this.id = Thing.THING_ID++;
this.shape.position(x,y);
// this.createBoundingBox(x,y);
- var bb = this.boundingBox = new Loc.BoundingBox(x1,y1, x2,y2);
+ var bb = this.boundingBox = new BoundingBox(x1,y1, x2,y2);
this.midpoint = bb.midpoint();
return this;
"src/evt/evt.class.js",
- "src/easel/math/math.js",
- "src/easel/math/vec.js",
- "src/easel/math/line.js",
-
- "src/easel/layer.js",
- "src/easel/shape/shape.js",
- "src/easel/shape/circle.js",
- "src/easel/shape/rect.js",
- "src/easel/shape/line.js",
- "src/easel/shape/polygon.js",
-
- "src/easel/util/binaryheap.js",
- "src/easel/util/graph.js",
- "src/easel/util/astar.js",
-
- "src/easel/util/tree/quadtree.js",
-
- "src/easel/loop/eventloop.js",
- "src/easel/loop/fps.js",
- "src/easel/loop/cooldown.js",
+ "src/ezl/math/math.js",
+ "src/ezl/math/vec.js",
+ "src/ezl/math/line.js",
+
+ "src/ezl/layer.js",
+ "src/ezl/shape/shape.js",
+ "src/ezl/shape/circle.js",
+ "src/ezl/shape/rect.js",
+ "src/ezl/shape/line.js",
+ "src/ezl/shape/polygon.js",
+
+ "src/ezl/util/binaryheap.js",
+ "src/ezl/util/graph.js",
+ "src/ezl/util/astar.js",
+
+ "src/ezl/util/tree/quadtree.js",
+
+ "src/ezl/loop/eventloop.js",
+ "src/ezl/loop/fps.js",
+ "src/ezl/loop/cooldown.js",
);
static function writeTags($scripts=null, $prefix="", $recompile=true) {