Phaser.Utils = { pad: function (str, len, pad, dir){ if (typeof (len) == "undefined") { var len = 0; } if (typeof (pad) == "undefined") { var pad = ' '; } if (typeof (dir) == "undefined") { var dir = 3; } if (len + 1 >= _AN_Read_length("length", str)) { switch (dir){ case 1: str = Array(len + 1 - _AN_Read_length("length", str)).join(pad) + str; break ; case 3: var right = Math.ceil((padlen = len - _AN_Read_length("length", str)) / 2); var left = padlen - right; str = Array(left + 1).join(pad) + str + Array(right + 1).join(pad); break ; default : { str = str + Array(len + 1 - _AN_Read_length("length", str)).join(pad); break ; } } } return str; } , isPlainObject: function (obj){ if (typeof (obj) !== "object" || obj.nodeType || obj === obj.window) { return false ; } try { if (obj.constructor && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { return false ; } } catch (e) { return false ; } return true ; } , extend: function (){ var options, name, src, copy, copyIsArray, clone, target = arguments[0] || { } , i = 1, length = _AN_Read_length("length", arguments), deep = false ; if (typeof target === "boolean") { deep = target; target = arguments[1] || { } ; i = 2; } if (length === i) { target = this; --i; } for (; i < length; i++ ){ if ((options = arguments[i]) != null ) { for (name in options){ src = target[name]; copy = options[name]; if (target === copy) { continue ; } if (deep && copy && (Phaser.Utils.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) { if (copyIsArray) { copyIsArray = false ; clone = src && Array.isArray(src)? src: [] ; } else { clone = src && Phaser.Utils.isPlainObject(src)? src: { } ; } target[name] = extend(deep, clone, copy); } else if (copy !== undefined) { target[name] = copy; } } } } return target; } } ; function HEXtoRGB(hex){ return [(hex >> 16 & 255) / 255, (hex >> 8 & 255) / 255, (hex & 255) / 255] ; } if (typeof Function.prototype.bind != 'function') { Function.prototype.bind = (function (){ var slice = Array.prototype.slice; return function (thisArg){ var target = this, boundArgs = slice.call(arguments, 1); if (typeof target != 'function') throw new TypeError() function bound(){ var args = boundArgs.concat(slice.call(arguments)); target.apply(this instanceof bound? this: thisArg, args); } bound.prototype = (function F(proto){ proto && (F.prototype = proto); if (!(this instanceof F)) return new F(); } )(target.prototype); return bound; } ; } )(); }