whisper.cat/weboasis/arcade/zombie/js/main.js
2023-10-05 23:28:32 +11:00

144 lines
65 KiB
JavaScript

(function(){var a="undefined"!==typeof window&&"undefined"!==typeof window.document?window.document:{},c="undefined"!==typeof module&&module.exports,b="undefined"!==typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,d=function(){for(var b,d=["requestFullscreen exitFullscreen fullscreenElement fullscreenEnabled fullscreenchange fullscreenerror".split(" "),"webkitRequestFullscreen webkitExitFullscreen webkitFullscreenElement webkitFullscreenEnabled webkitfullscreenchange webkitfullscreenerror".split(" "),
"webkitRequestFullScreen webkitCancelFullScreen webkitCurrentFullScreenElement webkitCancelFullScreen webkitfullscreenchange webkitfullscreenerror".split(" "),"mozRequestFullScreen mozCancelFullScreen mozFullScreenElement mozFullScreenEnabled mozfullscreenchange mozfullscreenerror".split(" "),"msRequestFullscreen msExitFullscreen msFullscreenElement msFullscreenEnabled MSFullscreenChange MSFullscreenError".split(" ")],c=0,g=d.length,f={};c<g;c++)if((b=d[c])&&b[1]in a){for(c=0;c<b.length;c++)f[d[0][c]]=
b[c];return f}return!1}(),f={change:d.fullscreenchange,error:d.fullscreenerror},g={request:function(c){var g=d.requestFullscreen;c=c||a.documentElement;if(/5\.1[.\d]* Safari/.test(navigator.userAgent))c[g]();else c[g](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){a[d.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(a){this.on("change",a)},onerror:function(a){this.on("error",a)},on:function(b,c){var d=f[b];d&&a.addEventListener(d,c,!1)},off:function(b,
c){var d=f[b];d&&a.removeEventListener(d,c,!1)},raw:d};d?(Object.defineProperties(g,{isFullscreen:{get:function(){return!!a[d.fullscreenElement]}},element:{enumerable:!0,get:function(){return a[d.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!a[d.fullscreenEnabled]}}}),c?module.exports=g:window.screenfull=g):c?module.exports=!1:window.screenfull=!1})();
(function(){function a(a){a=String(a);return a.charAt(0).toUpperCase()+a.slice(1)}function c(a,b){var c=-1,l=a?a.length:0;if("number"==typeof l&&-1<l&&l<=y)for(;++c<l;)b(a[c],c,a);else d(a,b)}function b(b){b=String(b).replace(/^ +| +$/g,"");return/^(?:webOS|i(?:OS|P))/.test(b)?b:a(b)}function d(a,b){for(var c in a)h.call(a,c)&&b(a[c],c,a)}function f(b){return null==b?a(b):x.call(b).slice(8,-1)}function g(a,b){var c=null!=a?typeof a[b]:"number";return!/^(?:boolean|number|string|undefined)$/.test(c)&&
("object"==c?!!a[b]:!0)}function k(a){return String(a).replace(/([ -])(?!$)/g,"$1?")}function n(a,b){var d=null;c(a,function(c,l){d=b(d,c,l,a)});return d}function l(a){function c(c){return n(c,function(c,d){var e=d.pattern||k(d);!c&&(c=RegExp("\\b"+e+" *\\d+[.\\w_]*","i").exec(a)||RegExp("\\b"+e+" *\\w+-[\\w]*","i").exec(a)||RegExp("\\b"+e+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(a))&&((c=String(d.label&&!RegExp(e,"i").test(d.label)?d.label:c).split("/"))[1]&&!/[\d.]+/.test(c[0])&&(c[0]+=
" "+c[1]),d=d.label||d,c=b(c[0].replace(RegExp(e,"i"),d).replace(RegExp("; *(?:"+d+"[_-])?","i")," ").replace(RegExp("("+d+")[-_.]?(\\w)","i"),"$1 $2")));return c})}function r(b){return n(b,function(b,c){return b||(RegExp(c+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(a)||0)[1]||null})}var m=w,h=a&&"object"==typeof a&&"String"!=f(a);h&&(m=a,a=null);var v=m.navigator||{},p=v.userAgent||"";a||(a=p);var u=h?!!v.likeChrome:/\bChrome\b/.test(a)&&!/internal|\n/i.test(x.toString()),
G=h?"Object":"ScriptBridgingProxyObject",A=h?"Object":"Environment",y=h&&m.java?"JavaPackage":f(m.java),N=h?"Object":"RuntimeObject";A=(y=/\bJava/.test(y)&&m.java)&&f(m.environment)==A;var Q=y?"a":"\u03b1",X=y?"b":"\u03b2",U=m.document||{},O=m.operamini||m.opera,R=z.test(R=h&&O?O["[[Class]]"]:f(O))?R:O=null,e,S=a;h=[];var T=null,P=a==p;p=P&&O&&"function"==typeof O.version&&O.version();var B=function(b){return n(b,function(b,c){return b||RegExp("\\b"+(c.pattern||k(c))+"\\b","i").exec(a)&&(c.label||
c)})}([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),q=function(b){return n(b,function(b,c){return b||RegExp("\\b"+(c.pattern||k(c))+"\\b","i").exec(a)&&(c.label||c)})}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser",
"PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},
{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),C=c([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad",
"iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),K=function(b){return n(b,function(b,c,d){return b||(c[C]||c[/^[a-z]+(?: +[a-z]+\b)*/i.exec(C)]||RegExp("\\b"+k(d)+"(?:\\b|\\w*\\d)","i").exec(a))&&d})}({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},
"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),t=function(c){return n(c,function(c,d){var e=d.pattern||k(d);if(!c&&(c=RegExp("\\b"+e+"(?:/[\\d.]+|[ \\w.]*)","i").exec(a))){var l=c,g=d.label||d,f={"10.0":"10","6.4":"10 Technical Preview",
"6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};e&&g&&/^Win/i.test(l)&&!/^Windows Phone /i.test(l)&&(f=f[/[\d.]+$/.exec(l)])&&(l="Windows "+f);l=String(l);e&&g&&(l=l.replace(RegExp(e,"i"),g));c=l=b(l.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/,
" $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}return c})}(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac",
"Windows 98;","Windows "]);B&&(B=[B]);K&&!C&&(C=c([K]));if(e=/\bGoogle TV\b/.exec(C))C=e[0];/\bSimulator\b/i.test(a)&&(C=(C?C+" ":"")+"Simulator");"Opera Mini"==q&&/\bOPiOS\b/.test(a)&&h.push("running in Turbo/Uncompressed mode");"IE"==q&&/\blike iPhone OS\b/.test(a)?(e=l(a.replace(/like iPhone OS/,"")),K=e.manufacturer,C=e.product):/^iP/.test(C)?(q||(q="Safari"),t="iOS"+((e=/ OS ([\d_]+)/i.exec(a))?" "+e[1].replace(/_/g,"."):"")):"Konqueror"!=q||/buntu/i.test(t)?K&&"Google"!=K&&(/Chrome/.test(q)&&
!/\bMobile Safari\b/i.test(a)||/\bVita\b/.test(C))||/\bAndroid\b/.test(t)&&/^Chrome/.test(q)&&/\bVersion\//i.test(a)?(q="Android Browser",t=/\bAndroid\b/.test(t)?t:"Android"):"Silk"==q?(/\bMobi/i.test(a)||(t="Android",h.unshift("desktop mode")),/Accelerated *= *true/i.test(a)&&h.unshift("accelerated")):"PaleMoon"==q&&(e=/\bFirefox\/([\d.]+)\b/.exec(a))?h.push("identifying as Firefox "+e[1]):"Firefox"==q&&(e=/\b(Mobile|Tablet|TV)\b/i.exec(a))?(t||(t="Firefox OS"),C||(C=e[1])):!q||(e=!/\bMinefield\b/i.test(a)&&
/\b(?:Firefox|Safari)\b/.exec(q))?(q&&!C&&/[\/,]|^[^(]+?\)/.test(a.slice(a.indexOf(e+"/")+8))&&(q=null),(e=C||K||t)&&(C||K||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(t))&&(q=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(t)?t:e)+" Browser")):"Electron"==q&&(e=(/\bChrome\/([\d.]+)\b/.exec(a)||0)[1])&&h.push("Chromium "+e):t="Kubuntu";p||(p=r(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",k(q),"(?:Firefox|Minefield|NetFront)"]));
if(e="iCab"==B&&3<parseFloat(p)&&"WebKit"||/\bOpera\b/.test(q)&&(/\bOPR\b/.test(a)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(a)&&!/^(?:Trident|EdgeHTML)$/.test(B)&&"WebKit"||!B&&/\bMSIE\b/i.test(a)&&("Mac OS"==t?"Tasman":"Trident")||"WebKit"==B&&/\bPlayStation\b(?! Vita\b)/i.test(q)&&"NetFront")B=[e];"IE"==q&&(e=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(a)||0)[1])?(q+=" Mobile",t="Windows Phone "+(/\+$/.test(e)?e:e+".x"),h.unshift("desktop mode")):/\bWPDesktop\b/i.test(a)?(q="IE Mobile",t="Windows Phone 8.x",
h.unshift("desktop mode"),p||(p=(/\brv:([\d.]+)/.exec(a)||0)[1])):"IE"!=q&&"Trident"==B&&(e=/\brv:([\d.]+)/.exec(a))&&(q&&h.push("identifying as "+q+(p?" "+p:"")),q="IE",p=e[1]);if(P){if(g(m,"global"))if(y&&(e=y.lang.System,S=e.getProperty("os.arch"),t=t||e.getProperty("os.name")+" "+e.getProperty("os.version")),A){try{p=m.require("ringo/engine").version.join("."),q="RingoJS"}catch(W){(e=m.system)&&e.global.system==m.system&&(q="Narwhal",t||(t=e[0].os||null))}q||(q="Rhino")}else"object"==typeof m.process&&
!m.process.browser&&(e=m.process)&&("object"==typeof e.versions&&("string"==typeof e.versions.electron?(h.push("Node "+e.versions.node),q="Electron",p=e.versions.electron):"string"==typeof e.versions.nw&&(h.push("Chromium "+p,"Node "+e.versions.node),q="NW.js",p=e.versions.nw)),q||(q="Node.js",S=e.arch,t=e.platform,p=(p=/[\d.]+/.exec(e.version))?p[0]:null));else f(e=m.runtime)==G?(q="Adobe AIR",t=e.flash.system.Capabilities.os):f(e=m.phantom)==N?(q="PhantomJS",p=(e=e.version||null)&&e.major+"."+e.minor+
"."+e.patch):"number"==typeof U.documentMode&&(e=/\bTrident\/(\d+)/i.exec(a))?(p=[p,U.documentMode],(e=+e[1]+4)!=p[1]&&(h.push("IE "+p[1]+" mode"),B&&(B[1]=""),p[1]=e),p="IE"==q?String(p[1].toFixed(1)):p[0]):"number"==typeof U.documentMode&&/^(?:Chrome|Firefox)\b/.test(q)&&(h.push("masking as "+q+" "+p),q="IE",p="11.0",B=["Trident"],t="Windows");t=t&&b(t)}p&&(e=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(p)||/(?:alpha|beta)(?: ?\d)?/i.exec(a+";"+(P&&v.appMinorVersion))||/\bMinefield\b/i.test(a)&&
"a")&&(T=/b/i.test(e)?"beta":"alpha",p=p.replace(RegExp(e+"\\+?$"),"")+("beta"==T?X:Q)+(/\d+\+?/.exec(e)||""));if("Fennec"==q||"Firefox"==q&&/\b(?:Android|Firefox OS)\b/.test(t))q="Firefox Mobile";else if("Maxthon"==q&&p)p=p.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(C))"Xbox 360"==C&&(t=null),"Xbox 360"==C&&/\bIEMobile\b/.test(a)&&h.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(q)&&(!q||C||/Browser|Mobi/.test(q))||"Windows CE"!=t&&!/Mobi/i.test(a))if("IE"==q&&P)try{null===m.external&&
h.unshift("platform preview")}catch(W){h.unshift("embedded")}else(/\bBlackBerry\b/.test(C)||/\bBB10\b/.test(a))&&(e=(RegExp(C.replace(/ +/g," *")+"/([.\\d]+)","i").exec(a)||0)[1]||p)?(e=[e,/BB10/.test(a)],t=(e[1]?(C=null,K="BlackBerry"):"Device Software")+" "+e[0],p=null):this!=d&&"Wii"!=C&&(P&&O||/Opera/.test(q)&&/\b(?:MSIE|Firefox)\b/i.test(a)||"Firefox"==q&&/\bOS X (?:\d+\.){2,}/.test(t)||"IE"==q&&(t&&!/^Win/.test(t)&&5.5<p||/\bWindows XP\b/.test(t)&&8<p||8==p&&!/\bTrident\b/.test(a)))&&!z.test(e=
l.call(d,a.replace(z,"")+";"))&&e.name&&(e="ing as "+e.name+((e=e.version)?" "+e:""),z.test(q)?(/\bIE\b/.test(e)&&"Mac OS"==t&&(t=null),e="identify"+e):(e="mask"+e,q=R?b(R.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(e)&&(t=null),P||(p=null)),B=["Presto"],h.push(e));else q+=" Mobile";if(e=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(a)||0)[1]){e=[parseFloat(e.replace(/\.(\d)$/,".0$1")),e];if("Safari"==q&&"+"==e[1].slice(-1))q="WebKit Nightly",T="alpha",p=e[1].slice(0,-1);else if(p==e[1]||p==(e[2]=
(/\bSafari\/([\d.]+\+?)/i.exec(a)||0)[1]))p=null;e[1]=(/\bChrome\/([\d.]+)/i.exec(a)||0)[1];537.36==e[0]&&537.36==e[2]&&28<=parseFloat(e[1])&&"WebKit"==B&&(B=["Blink"]);P&&(u||e[1])?(B&&(B[1]="like Chrome"),e=e[1]||(e=e[0],530>e?1:532>e?2:532.05>e?3:533>e?4:534.03>e?5:534.07>e?6:534.1>e?7:534.13>e?8:534.16>e?9:534.24>e?10:534.3>e?11:535.01>e?12:535.02>e?"13+":535.07>e?15:535.11>e?16:535.19>e?17:536.05>e?18:536.1>e?19:537.01>e?20:537.11>e?"21+":537.13>e?23:537.18>e?24:537.24>e?25:537.36>e?26:"Blink"!=
B?"27":"28")):(B&&(B[1]="like Safari"),e=(e=e[0],400>e?1:500>e?2:526>e?3:533>e?4:534>e?"4+":535>e?5:537>e?6:538>e?7:601>e?8:"8"));B&&(B[1]+=" "+(e+="number"==typeof e?".x":/[.+]/.test(e)?"":"+"));"Safari"==q&&(!p||45<parseInt(p))&&(p=e)}"Opera"==q&&(e=/\bzbov|zvav$/.exec(t))?(q+=" ",h.unshift("desktop mode"),"zvav"==e?(q+="Mini",p=null):q+="Mobile",t=t.replace(RegExp(" *"+e+"$"),"")):"Safari"==q&&/\bChrome\b/.exec(B&&B[1])&&(h.unshift("desktop mode"),q="Chrome Mobile",p=null,/\bOS X\b/.test(t)?(K=
"Apple",t="iOS 4.3+"):t=null);p&&0==p.indexOf(e=/[\d.]+$/.exec(t))&&-1<a.indexOf("/"+e+"-")&&(t=String(t.replace(e,"")).replace(/^ +| +$/g,""));B&&!/\b(?:Avant|Nook)\b/.test(q)&&(/Browser|Lunascape|Maxthon/.test(q)||"Safari"!=q&&/^iOS/.test(t)&&/\bSafari\b/.test(B[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(q)&&B[1])&&(e=B[B.length-1])&&h.push(e);h.length&&(h=["("+h.join("; ")+")"]);K&&C&&0>C.indexOf(K)&&h.push("on "+K);C&&h.push((/^on /.test(h[h.length-
1])?"":"on ")+C);if(t){var V=(e=/ ([\d.+]+)$/.exec(t))&&"/"==t.charAt(t.length-e[0].length-1);t={architecture:32,family:e&&!V?t.replace(e[0],""):t,version:e?e[1]:null,toString:function(){var a=this.version;return this.family+(a&&!V?" "+a:"")+(64==this.architecture?" 64-bit":"")}}}(e=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(S))&&!/\bi686\b/i.test(S)?(t&&(t.architecture=64,t.family=t.family.replace(RegExp(" *"+e),"")),q&&(/\bWOW64\b/i.test(a)||P&&/\w(?:86|32)$/.test(v.cpuClass||v.platform)&&!/\bWin64; x64\b/i.test(a))&&
h.unshift("32-bit")):t&&/^OS X/.test(t.family)&&"Chrome"==q&&39<=parseFloat(p)&&(t.architecture=64);a||(a=null);m={};m.description=a;m.layout=B&&B[0];m.manufacturer=K;m.name=q;m.prerelease=T;m.product=C;m.ua=a;m.version=q&&p;m.os=t||{architecture:null,family:null,version:null,toString:function(){return"null"}};m.parse=l;m.toString=function(){return this.description||""};m.version&&h.unshift(p);m.name&&h.unshift(q);t&&q&&(t!=String(t).split(" ")[0]||t!=q.split(" ")[0]&&!C)&&h.push(C?"("+t+")":"on "+
t);h.length&&(m.description=h.join(" "));return m}var m={"function":!0,object:!0},w=m[typeof window]&&window||this,v=m[typeof exports]&&exports;m=m[typeof module]&&module&&!module.nodeType&&module;var r=v&&m&&"object"==typeof global&&global;!r||r.global!==r&&r.window!==r&&r.self!==r||(w=r);var y=Math.pow(2,53)-1,z=/\bOpera/;r=Object.prototype;var h=r.hasOwnProperty,x=r.toString,A=l();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(w.platform=A,define(function(){return A})):v&&
m?d(A,function(a,b){v[b]=a}):w.platform=A}).call(this);
function buildIOSMeta(){for(var a=[{name:"viewport",content:"width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"},{name:"apple-mobile-web-app-capable",content:"yes"},{name:"apple-mobile-web-app-status-bar-style",content:"black"}],c=0;c<a.length;c++){var b=document.createElement("meta");b.name=a[c].name;b.content=a[c].content;var d=window.document.head.querySelector('meta[name="'+b.name+'"]');d&&d.parentNode.removeChild(d);window.document.head.appendChild(b)}}
function hideIOSFullscreenPanel(){jQuery(".xxx-ios-fullscreen-message").css("display","none");jQuery(".xxx-ios-fullscreen-scroll").css("display","none");jQuery(".xxx-game-iframe-full").removeClass("xxx-game-iframe-iphone-se")}function buildIOSFullscreenPanel(){jQuery("body").append('<div class="xxx-ios-fullscreen-message"><div class="xxx-ios-fullscreen-swipe"></div></div><div class="xxx-ios-fullscreen-scroll"></div>')}
function showIOSFullscreenPanel(){jQuery(".xxx-ios-fullscreen-message").css("display","block");jQuery(".xxx-ios-fullscreen-scroll").css("display","block")}
function __iosResize(){window.scrollTo(0,0);if("iPhone"===platform.product)switch(window.devicePixelRatio){case 2:switch(window.innerWidth){case 568:320!==window.innerHeight&&jQuery(".xxx-game-iframe-full").addClass("xxx-game-iframe-iphone-se");break;case 667:375===window.innerHeight?hideIOSFullscreenPanel():showIOSFullscreenPanel();break;default:hideIOSFullscreenPanel()}break;case 3:switch(window.innerWidth){case 736:414===window.innerHeight?hideIOSFullscreenPanel():showIOSFullscreenPanel();break;
case 724:375===window.innerHeight?hideIOSFullscreenPanel():showIOSFullscreenPanel();break;default:hideIOSFullscreenPanel()}break;default:hideIOSFullscreenPanel()}}function iosResize(){__iosResize();setTimeout(function(){__iosResize()},500)}$(document).ready(function(){platform&&"iPhone"===platform.product&&"Safari"===platform.name&&(buildIOSFullscreenPanel(),buildIOSMeta())});jQuery(window).resize(function(){platform&&"iPhone"===platform.product&&"Safari"===platform.name&&iosResize()});
var s_iScaleFactor=1,s_iOffsetX,s_iOffsetY,s_bIsIphone;
(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(ad|hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|tablet|treo|up\.(browser|link)|vodafone|wap|webos|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||
navigator.vendor||window.opera);$(window).resize(function(){sizeHandler()});function trace(a){console.log(a)}window.addEventListener("orientationchange",onOrientationChange);function onOrientationChange(){window.matchMedia("(orientation: portrait)").matches&&sizeHandler();window.matchMedia("(orientation: landscape)").matches&&sizeHandler()}
function getSize(a){var c=a.toLowerCase(),b=window.document,d=b.documentElement;if(void 0===window["inner"+a])a=d["client"+a];else if(window["inner"+a]!=d["client"+a]){var f=b.createElement("body");f.id="vpw-test-b";f.style.cssText="overflow:scroll";var g=b.createElement("div");g.id="vpw-test-d";g.style.cssText="position:absolute;top:-1000px";g.innerHTML="<style>@media("+c+":"+d["client"+a]+"px){body#vpw-test-b div#vpw-test-d{"+c+":7px!important}}</style>";f.appendChild(g);d.insertBefore(f,b.head);
a=7==g["offset"+a]?d["client"+a]:window["inner"+a];d.removeChild(f)}else a=window["inner"+a];return a}
function sizeHandler(){window.scrollTo(0,1);if($("#canvas")){var a="safari"===platform.name.toLowerCase()?getIOSWindowHeight():getSize("Height");var c=getSize("Width");_checkOrientation(c,a);var b=Math.min(a/CANVAS_HEIGHT,c/CANVAS_WIDTH),d=CANVAS_WIDTH*b;b*=CANVAS_HEIGHT;if(b<a){var f=a-b;b+=f;d+=CANVAS_WIDTH/CANVAS_HEIGHT*f}else d<c&&(f=c-d,d+=f,b+=CANVAS_HEIGHT/CANVAS_WIDTH*f);f=a/2-b/2;var g=c/2-d/2,k=CANVAS_WIDTH/d;if(g*k<-EDGEBOARD_X||f*k<-EDGEBOARD_Y)b=Math.min(a/(CANVAS_HEIGHT-2*EDGEBOARD_Y),
c/(CANVAS_WIDTH-2*EDGEBOARD_X)),d=CANVAS_WIDTH*b,b*=CANVAS_HEIGHT,f=(a-b)/2,g=(c-d)/2,k=CANVAS_WIDTH/d;s_iOffsetX=-1*g*k;s_iOffsetY=-1*f*k;0<=f&&(s_iOffsetY=0);0<=g&&(s_iOffsetX=0);null!==s_oInterface&&s_oInterface.refreshButtonPos(s_iOffsetX,s_iOffsetY);null!==s_oMenu&&s_oMenu.refreshButtonPos(s_iOffsetX,s_iOffsetY);s_bIsIphone?(canvas=document.getElementById("canvas"),s_oStage.canvas.width=2*d,s_oStage.canvas.height=2*b,canvas.style.width=d+"px",canvas.style.height=b+"px",s_iScaleFactor=2*Math.min(d/
CANVAS_WIDTH,b/CANVAS_HEIGHT),s_oStage.scaleX=s_oStage.scaleY=s_iScaleFactor):s_bMobile||isChrome()?($("#canvas").css("width",d+"px"),$("#canvas").css("height",b+"px")):(s_oStage.canvas.width=d,s_oStage.canvas.height=b,s_iScaleFactor=Math.min(d/CANVAS_WIDTH,b/CANVAS_HEIGHT),s_oStage.scaleX=s_oStage.scaleY=s_iScaleFactor);0>f||(f=(a-b)/2);$("#canvas").css("top",f+"px");$("#canvas").css("left",g+"px");fullscreenHandler()}}
function isChrome(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function isIOS(){for(var a="iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";");a.length;)if(navigator.platform===a.pop())return s_bIsIphone=!0;return s_bIsIphone=!1}function getIOSWindowHeight(){return document.documentElement.clientWidth/window.innerWidth*window.innerHeight}
function getHeightOfIOSToolbars(){var a=(0===window.orientation?screen.height:screen.width)-getIOSWindowHeight();return 1<a?a:0}
function _checkOrientation(a,c){s_bMobile&&ENABLE_CHECK_ORIENTATION&&(a>c?"landscape"===$(".orientation-msg-container").attr("data-orientation")?($(".orientation-msg-container").css("display","none"),s_oMain.startUpdate()):($(".orientation-msg-container").css("display","block"),s_oMain.stopUpdate()):"portrait"===$(".orientation-msg-container").attr("data-orientation")?($(".orientation-msg-container").css("display","none"),s_oMain.startUpdate()):($(".orientation-msg-container").css("display","block"),
s_oMain.stopUpdate()))}function playSound(a,c,b){return!1===DISABLE_SOUND_MOBILE||!1===s_bMobile?(s_aSounds[a].play(),s_aSounds[a].volume(c),s_aSounds[a].loop(b),s_aSounds[a]):null}function stopSound(a){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||s_aSounds[a].stop()}function setVolume(a,c){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||s_aSounds[a].volume(c)}function setMute(a,c){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||s_aSounds[a].mute(c)}
function fadeSound(a,c,b,d){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||s_aSounds[a].fade(c,b,d)}function soundPlaying(a){if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)return s_aSounds[a].playing()}function createBitmap(a,c,b){var d=new createjs.Bitmap(a),f=new createjs.Shape;c&&b?f.graphics.beginFill("#fff").drawRect(0,0,c,b):f.graphics.beginFill("#ff0").drawRect(0,0,a.width,a.height);d.hitArea=f;return d}
function createSprite(a,c,b,d,f,g){a=null!==c?new createjs.Sprite(a,c):new createjs.Sprite(a);c=new createjs.Shape;c.graphics.beginFill("#000000").drawRect(-b,-d,f,g);a.hitArea=c;return a}function randomFloatBetween(a,c,b){"undefined"===typeof b&&(b=2);return parseFloat(Math.min(a+Math.random()*(c-a),c).toFixed(b))}function shuffle(a){for(var c=a.length,b,d;0!==c;)d=Math.floor(Math.random()*c),--c,b=a[c],a[c]=a[d],a[d]=b;return a}
function bubbleSort(a){do{var c=!1;for(var b=0;b<a.length-1;b++)a[b]>a[b+1]&&(c=a[b],a[b]=a[b+1],a[b+1]=c,c=!0)}while(c)}function easeLinear(a,c,b,d){return b*a/d+c}function easeInQuad(a,c,b,d){return b*(a/=d)*a+c}function easeInSine(a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c}function easeInCubic(a,c,b,d){return b*(a/=d)*a*a+c}
function getTrajectoryPoint(a,c){var b=new createjs.Point,d=(1-a)*(1-a),f=a*a;b.x=d*c.start.x+2*(1-a)*a*c.traj.x+f*c.end.x;b.y=d*c.start.y+2*(1-a)*a*c.traj.y+f*c.end.y;return b}function formatTime(a){a/=1E3;var c=Math.floor(a/60);a=parseFloat(a-60*c).toFixed(1);var b="";b=10>c?b+("0"+c+":"):b+(c+":");return 10>a?b+("0"+a):b+a}function degreesToRadians(a){return a*Math.PI/180}function checkRectCollision(a,c){var b=getBounds(a,.9);var d=getBounds(c,.98);return calculateIntersection(b,d)}
function calculateIntersection(a,c){var b,d,f,g;var k=a.x+(b=a.width/2);var n=a.y+(d=a.height/2);var l=c.x+(f=c.width/2);var m=c.y+(g=c.height/2);k=Math.abs(k-l)-(b+f);n=Math.abs(n-m)-(d+g);return 0>k&&0>n?(k=Math.min(Math.min(a.width,c.width),-k),n=Math.min(Math.min(a.height,c.height),-n),{x:Math.max(a.x,c.x),y:Math.max(a.y,c.y),width:k,height:n,rect1:a,rect2:c}):null}
function getBounds(a,c){var b={x:Infinity,y:Infinity,width:0,height:0};if(a instanceof createjs.Container){b.x2=-Infinity;b.y2=-Infinity;var d=a.children,f=d.length,g;for(g=0;g<f;g++){var k=getBounds(d[g],1);k.x<b.x&&(b.x=k.x);k.y<b.y&&(b.y=k.y);k.x+k.width>b.x2&&(b.x2=k.x+k.width);k.y+k.height>b.y2&&(b.y2=k.y+k.height)}Infinity==b.x&&(b.x=0);Infinity==b.y&&(b.y=0);Infinity==b.x2&&(b.x2=0);Infinity==b.y2&&(b.y2=0);b.width=b.x2-b.x;b.height=b.y2-b.y;delete b.x2;delete b.y2}else{if(a instanceof createjs.Bitmap){f=
a.sourceRect||a.image;g=f.width*c;var n=f.height*c}else if(a instanceof createjs.Sprite)if(a.spriteSheet._frames&&a.spriteSheet._frames[a.currentFrame]&&a.spriteSheet._frames[a.currentFrame].image){f=a.spriteSheet.getFrame(a.currentFrame);g=f.rect.width;n=f.rect.height;d=f.regX;var l=f.regY}else b.x=a.x||0,b.y=a.y||0;else b.x=a.x||0,b.y=a.y||0;d=d||0;g=g||0;l=l||0;n=n||0;b.regX=d;b.regY=l;f=a.localToGlobal(0-d,0-l);k=a.localToGlobal(g-d,n-l);g=a.localToGlobal(g-d,0-l);d=a.localToGlobal(0-d,n-l);b.x=
Math.min(Math.min(Math.min(f.x,k.x),g.x),d.x);b.y=Math.min(Math.min(Math.min(f.y,k.y),g.y),d.y);b.width=Math.max(Math.max(Math.max(f.x,k.x),g.x),d.x)-b.x;b.height=Math.max(Math.max(Math.max(f.y,k.y),g.y),d.y)-b.y}return b}function NoClickDelay(a){this.element=a;window.Touch&&this.element.addEventListener("touchstart",this,!1)}function shuffle(a){for(var c=a.length,b,d;0<c;)d=Math.floor(Math.random()*c),c--,b=a[c],a[c]=a[d],a[d]=b;return a}
NoClickDelay.prototype={handleEvent:function(a){switch(a.type){case "touchstart":this.onTouchStart(a);break;case "touchmove":this.onTouchMove(a);break;case "touchend":this.onTouchEnd(a)}},onTouchStart:function(a){a.preventDefault();this.moved=!1;this.element.addEventListener("touchmove",this,!1);this.element.addEventListener("touchend",this,!1)},onTouchMove:function(a){this.moved=!0},onTouchEnd:function(a){this.element.removeEventListener("touchmove",this,!1);this.element.removeEventListener("touchend",
this,!1);if(!this.moved){a=document.elementFromPoint(a.changedTouches[0].clientX,a.changedTouches[0].clientY);3==a.nodeType&&(a=a.parentNode);var c=document.createEvent("MouseEvents");c.initEvent("click",!0,!0);a.dispatchEvent(c)}}};
(function(){function a(a){var b={focus:"visible",focusin:"visible",pageshow:"visible",blur:"hidden",focusout:"hidden",pagehide:"hidden"};a=a||window.event;a.type in b?document.body.className=b[a.type]:(document.body.className=this[c]?"hidden":"visible","hidden"===document.body.className?s_oMain.stopUpdate():s_oMain.startUpdate())}var c="hidden";c in document?document.addEventListener("visibilitychange",a):(c="mozHidden")in document?document.addEventListener("mozvisibilitychange",a):(c="webkitHidden")in
document?document.addEventListener("webkitvisibilitychange",a):(c="msHidden")in document?document.addEventListener("msvisibilitychange",a):"onfocusin"in document?document.onfocusin=document.onfocusout=a:window.onpageshow=window.onpagehide=window.onfocus=window.onblur=a})();function ctlArcadeResume(){null!==s_oMain&&s_oMain.startUpdate()}function ctlArcadePause(){null!==s_oMain&&s_oMain.stopUpdate()}
function getParamValue(a){for(var c=window.location.search.substring(1).split("&"),b=0;b<c.length;b++){var d=c[b].split("=");if(d[0]==a)return d[1]}}function fullscreenHandler(){ENABLE_FULLSCREEN&&screenfull.enabled&&(s_bFullscreen=screenfull.isFullscreen,null!==s_oInterface&&s_oInterface.resetFullscreenBut(),null!==s_oMenu&&s_oMenu.resetFullscreenBut())}
if(screenfull.enabled)screenfull.on("change",function(){s_bFullscreen=screenfull.isFullscreen;null!==s_oInterface&&s_oInterface.resetFullscreenBut();null!==s_oMenu&&s_oMenu.resetFullscreenBut()});
function CSpriteLibrary(){var a={},c,b,d,f,g,k;this.init=function(a,l,m){c={};d=b=0;f=a;g=l;k=m};this.addSprite=function(d,l){if(!a.hasOwnProperty(d)){var g=new Image;a[d]=c[d]={szPath:l,oSprite:g,bLoaded:!1};b++}};this.getSprite=function(b){return a.hasOwnProperty(b)?a[b].oSprite:null};this._onSpritesLoaded=function(){b=0;g.call(k)};this._onSpriteLoaded=function(){f.call(k);++d===b&&this._onSpritesLoaded()};this.loadSprites=function(){for(var a in c)c[a].oSprite.oSpriteLibrary=this,c[a].oSprite.szKey=
a,c[a].oSprite.onload=function(){this.oSpriteLibrary.setLoaded(this.szKey);this.oSpriteLibrary._onSpriteLoaded(this.szKey)},c[a].oSprite.onerror=function(a){var b=a.currentTarget;setTimeout(function(){c[b.szKey].oSprite.src=c[b.szKey].szPath},500)},c[a].oSprite.src=c[a].szPath};this.setLoaded=function(b){a[b].bLoaded=!0};this.isLoaded=function(b){return a[b].bLoaded};this.getNumSprites=function(){return b}}
CTLText.prototype={constructor:CTLText,__autofit:function(){if(this._bFitText){for(var a=this._iFontSize;(this._oText.getBounds().height>this._iHeight-2*this._iPaddingV||this._oText.getBounds().width>this._iWidth-2*this._iPaddingH)&&!(a--,this._oText.font=a+"px "+this._szFont,this._oText.lineHeight=Math.round(a*this._fLineHeightFactor),this.__updateY(),this.__verticalAlign(),8>a););this._iFontSize=a}},__verticalAlign:function(){if(this._bVerticalAlign){var a=this._oText.getBounds().height;this._oText.y-=
(a-this._iHeight)/2+this._iPaddingV}},__updateY:function(){this._oText.y=this._y+this._iPaddingV;switch(this._oText.textBaseline){case "middle":this._oText.y+=this._oText.lineHeight/2+(this._iFontSize*this._fLineHeightFactor-this._iFontSize)}},__createText:function(a){this._bDebug&&(this._oDebugShape=new createjs.Shape,this._oDebugShape.graphics.beginFill("rgba(255,0,0,0.5)").drawRect(this._x,this._y,this._iWidth,this._iHeight),this._oContainer.addChild(this._oDebugShape));this._oText=new createjs.Text(a,
this._iFontSize+"px "+this._szFont,this._szColor);this._oText.textBaseline="middle";this._oText.lineHeight=Math.round(this._iFontSize*this._fLineHeightFactor);this._oText.textAlign=this._szAlign;this._oText.lineWidth=this._bMultiline?this._iWidth-2*this._iPaddingH:null;switch(this._szAlign){case "center":this._oText.x=this._x+this._iWidth/2;break;case "left":this._oText.x=this._x+this._iPaddingH;break;case "right":this._oText.x=this._x+this._iWidth-this._iPaddingH}this._oContainer.addChild(this._oText);
this.refreshText(a)},setVerticalAlign:function(a){this._bVerticalAlign=a},setOutline:function(a){null!==this._oText&&(this._oText.outline=a)},setShadow:function(a,c,b,d){null!==this._oText&&(this._oText.shadow=new createjs.Shadow(a,c,b,d))},setColor:function(a){this._oText.color=a},setAlpha:function(a){this._oText.alpha=a},setY:function(a){this._y=this._oText.y=a},removeTweens:function(){createjs.Tween.removeTweens(this._oText)},getText:function(){return this._oText},getY:function(){return this._y},
getFontSize:function(){return this._iFontSize},refreshText:function(a){""===a&&(a=" ");null===this._oText&&this.__createText(a);this._oText.text=a;this._oText.font=this._iFontSize+"px "+this._szFont;this._oText.lineHeight=Math.round(this._iFontSize*this._fLineHeightFactor);this.__autofit();this.__updateY();this.__verticalAlign()}};
function CTLText(a,c,b,d,f,g,k,n,l,m,w,v,r,y,z,h,x){this._oContainer=a;this._x=c;this._y=b;this._iWidth=d;this._iHeight=f;this._bMultiline=h;this._iFontSize=g;this._szAlign=k;this._szColor=n;this._szFont=l;this._iPaddingH=w;this._iPaddingV=v;this._bVerticalAlign=z;this._bFitText=y;this._bDebug=x;this._oDebugShape=null;this._fLineHeightFactor=m;this._oText=null;r&&this.__createText(r)}
var CANVAS_WIDTH=1136,CANVAS_HEIGHT=832,EDGEBOARD_X=0,EDGEBOARD_Y=200,PRIMARY_FONT="ZombieA",DISABLE_SOUND_MOBILE=!1,FPS=30,FPS_TIME=1E3/FPS,SOUNDTRACK_VOLUME_IN_GAME=.25,STATE_LOADING=0,STATE_MENU=1,STATE_HELP=1,STATE_GAME=3,ON_MOUSE_DOWN=0,ON_MOUSE_UP=1,ON_MOUSE_OVER=2,ON_MOUSE_OUT=3,ON_DRAG_START=4,ON_DRAG_END=5,ON_PRESS_MOVE=6,PLAYER_LIFE,SPAWN_TIME,SPAWN_TIME_DECREASE,STAGE_START_TIME,STAGE_TIME_INCREASE,MAX_START_TOP=370,MAX_START_BOT=750,MAX_END_TOP=410,MAX_END_BOT=750,START_SIZE=MAX_START_BOT-
MAX_START_TOP,END_SIZE=MAX_END_BOT-MAX_END_TOP,ZOMBIE_ON_STAGE=[],MAX_SPAWN=[],SURVIVOR_ON_STAGE,AD_SHOW_COUNTER,ENABLE_CHECK_ORIENTATION,ENABLE_FULLSCREEN,DEATH_FRAMES=[57,53,57,57,57],RUN_FRAMES=[28,28,19,20,16],OFFSET_ANIMATION=[70,-50,50,80,70],ANIM_DELAY=[0,0,0,0,1],OFFSET_BLOOD=[{x:0,y:50},{x:50,y:50},{x:0,y:50},{x:0,y:50},{x:0,y:50}],CORRECTION=[{x:20,y:10,w:90,h:180},{x:35,y:20,w:80,h:165},{x:25,y:10,w:70,h:140},{x:45,y:15,w:90,h:180},{x:45,y:15,w:90,h:180}],BAR_POS=[{x:120,y:0},{x:120,y:10},
{x:100,y:0},{x:150,y:0},{x:130,y:0}],SPEED=[11E3,9E3,1E4,5E3,6E3],LIFE=[],DAMAGE=[],SCORE=[],TEXT_GAMEOVER="GAME OVER",TEXT_SCORE="SCORE",TEXT_PLAY="PLAY",TEXT_HEALTH="HEALTH",TEXT_WAVE="WAVE",TEXT_HELP1="TAP THE SCREEN TO KILL THE ZOMBIES!",TEXT_HELP2="SAVE THE SURVIVOR TO GET EXTRA ENERGY!",TEXT_HELP3="IF YOU LOSE ALL YOUR HEALTH, YOU WILL DIE!",TEXT_PAUSE="PAUSE",TEXT_PRELOADER_CONTINUE="START",TEXT_DEVELOPED="HOSTED BY",TEXT_SHARE_IMAGE="200x200.jpg",TEXT_SHARE_TITLE="Congratulations!",TEXT_SHARE_MSG1=
"You collected <strong>",TEXT_SHARE_MSG2=" points</strong>!<br><br>Share your score with your friends!",TEXT_SHARE_SHARE1="My score is ",TEXT_SHARE_SHARE2=" points! Can you do better?";
function CPreloader(){var a,c,b,d,f,g,k,n,l,m;this._init=function(){s_oSpriteLibrary.init(this._onImagesLoaded,this._onAllImagesLoaded,this);s_oSpriteLibrary.addSprite("progress_bar","./sprites/progress_bar.png");s_oSpriteLibrary.addSprite("200x200","./sprites/200x200.jpg");s_oSpriteLibrary.addSprite("but_start","./sprites/but_start.png");s_oSpriteLibrary.loadSprites();m=new createjs.Container;s_oStage.addChild(m)};this.unload=function(){m.removeAllChildren();l.unload()};this._onImagesLoaded=function(){};
this._onAllImagesLoaded=function(){this.attachSprites();s_oMain.preloaderReady()};this.attachSprites=function(){var w=new createjs.Shape;w.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);m.addChild(w);w=s_oSpriteLibrary.getSprite("200x200");k=createBitmap(w);k.regX=.5*w.width;k.regY=.5*w.height;k.x=CANVAS_WIDTH/2;k.y=CANVAS_HEIGHT/2-120;m.addChild(k);n=new createjs.Shape;n.graphics.beginFill("rgba(0,0,0,0.01)").drawRoundRect(k.x-100,k.y-100,200,200,10);m.addChild(n);k.mask=n;
w=s_oSpriteLibrary.getSprite("progress_bar");d=createBitmap(w);d.x=CANVAS_WIDTH/2-w.width/2;d.y=CANVAS_HEIGHT/2+50;m.addChild(d);a=w.width;c=w.height;f=new createjs.Shape;f.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(d.x,d.y,1,c);m.addChild(f);d.mask=f;b=new createjs.Text("","40px "+PRIMARY_FONT,"#fff");b.x=CANVAS_WIDTH/2;b.y=CANVAS_HEIGHT/2+110;b.textBaseline="alphabetic";b.textAlign="center";m.addChild(b);w=s_oSpriteLibrary.getSprite("but_start");l=new CTextButton(CANVAS_WIDTH/2,CANVAS_HEIGHT/
2,w,TEXT_PRELOADER_CONTINUE,"Arial","#000","bold 50",m);l.addEventListener(ON_MOUSE_UP,this._onButStartRelease,this);l.setVisible(!1);g=new createjs.Shape;g.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);m.addChild(g);createjs.Tween.get(g).to({alpha:0},500).call(function(){createjs.Tween.removeTweens(g);m.removeChild(g)})};this._onButStartRelease=function(){s_oMain._onRemovePreloader()};this.refreshLoader=function(l){b.text=l+"%";100===l&&(s_oMain._onRemovePreloader(),b.visible=
!1,d.visible=!1);f.graphics.clear();l=Math.floor(l*a/100);f.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(d.x,d.y,l,c)};this._init()}
function CMain(a){var c,b=0,d=0,f=STATE_LOADING,g,k;this.initContainer=function(){s_oCanvas=document.getElementById("canvas");s_oStage=new createjs.Stage(s_oCanvas);createjs.Touch.enable(s_oStage);s_bMobile=jQuery.browser.mobile;!1===s_bMobile&&(s_oStage.enableMouseOver(20),$("body").on("contextmenu","#canvas",function(a){return!1}));s_iPrevTime=(new Date).getTime();createjs.Ticker.addEventListener("tick",this._update);createjs.Ticker.framerate=FPS;navigator.userAgent.match(/Windows Phone/i)&&(DISABLE_SOUND_MOBILE=
!0);s_oSpriteLibrary=new CSpriteLibrary;g=new CPreloader};this.preloaderReady=function(){this._loadImages();!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||this._initSounds()};this.soundLoaded=function(){b++;g.refreshLoader(Math.floor(b/d*100))};this._initSounds=function(){Howler.mute(!s_bAudioActive);s_aSoundsInfo=[];s_aSoundsInfo.push({path:"./sounds/",filename:"soundtrack",loop:!0,volume:1,ingamename:"soundtrack"});s_aSoundsInfo.push({path:"./sounds/",filename:"press_button",loop:!1,volume:1,ingamename:"click"});
s_aSoundsInfo.push({path:"./sounds/",filename:"survivor_scream",loop:!1,volume:1,ingamename:"survivor_scream"});s_aSoundsInfo.push({path:"./sounds/",filename:"tap_zombie",loop:!1,volume:1,ingamename:"tap_zombie"});s_aSoundsInfo.push({path:"./sounds/",filename:"zombie_crowd",loop:!1,volume:1,ingamename:"zombie_crowd"});d+=s_aSoundsInfo.length;s_aSounds=[];for(var a=0;a<s_aSoundsInfo.length;a++)this.tryToLoadSound(s_aSoundsInfo[a],!1)};this.tryToLoadSound=function(a,b){setTimeout(function(){s_aSounds[a.ingamename]=
new Howl({src:[a.path+a.filename+".mp3"],autoplay:!1,preload:!0,loop:a.loop,volume:a.volume,onload:s_oMain.soundLoaded,onloaderror:function(a,b){for(var c=0;c<s_aSoundsInfo.length;c++)if(a===s_aSounds[s_aSoundsInfo[c].ingamename]._sounds[0]._id){s_oMain.tryToLoadSound(s_aSoundsInfo[c],!0);break}},onplayerror:function(a){for(var b=0;b<s_aSoundsInfo.length;b++)if(a===s_aSounds[s_aSoundsInfo[b].ingamename]._sounds[0]._id){s_aSounds[s_aSoundsInfo[b].ingamename].once("unlock",function(){s_aSounds[s_aSoundsInfo[b].ingamename].play();
"soundtrack"===s_aSoundsInfo[b].ingamename&&null!==s_oGame&&setVolume("soundtrack",SOUNDTRACK_VOLUME_IN_GAME)});break}}})},b?200:0)};this._loadImages=function(){s_oSpriteLibrary.init(this._onImagesLoaded,this._onAllImagesLoaded,this);s_oSpriteLibrary.addSprite("but_play","./sprites/but_play.png");s_oSpriteLibrary.addSprite("msg_box","./sprites/msg_box.png");s_oSpriteLibrary.addSprite("ctl_logo","./sprites/ctl_logo.png");s_oSpriteLibrary.addSprite("bg_menu","./sprites/bg_menu.jpg");s_oSpriteLibrary.addSprite("bg_game",
"./sprites/bg_game.jpg");s_oSpriteLibrary.addSprite("but_exit","./sprites/but_exit.png");s_oSpriteLibrary.addSprite("audio_icon","./sprites/audio_icon.png");s_oSpriteLibrary.addSprite("pause_icon","./sprites/pause_icon.png");s_oSpriteLibrary.addSprite("but_credits","./sprites/but_credits.png");s_oSpriteLibrary.addSprite("but_fullscreen","./sprites/but_fullscreen.png");s_oSpriteLibrary.addSprite("bridge","./sprites/bridge.png");s_oSpriteLibrary.addSprite("energy_bar_bg","./sprites/energy_bar_bg.png");
s_oSpriteLibrary.addSprite("energy_bar_fill","./sprites/energy_bar_fill.png");s_oSpriteLibrary.addSprite("enemy_bar_bg","./sprites/enemy_bar_bg.png");s_oSpriteLibrary.addSprite("enemy_bar_fill","./sprites/enemy_bar_fill.png");s_oSpriteLibrary.addSprite("blood_floor","./sprites/blood_floor.png");s_oSpriteLibrary.addSprite("game_over_bg","./sprites/game_over_bg.png");for(var a=0;57>=a;a++)s_oSpriteLibrary.addSprite("zombie0_death"+a,"./sprites/zombie_00/death/zombiedeath0_"+a+".png");for(a=0;28>=a;a++)s_oSpriteLibrary.addSprite("zombie0_run"+
a,"./sprites/zombie_00/run/zombierun0_"+a+".png");for(a=0;53>=a;a++)s_oSpriteLibrary.addSprite("zombie1_death"+a,"./sprites/zombie_01/death/zombiedeath1_"+a+".png");for(a=0;28>=a;a++)s_oSpriteLibrary.addSprite("zombie1_run"+a,"./sprites/zombie_01/run/zombierun1_"+a+".png");for(a=0;57>=a;a++)s_oSpriteLibrary.addSprite("zombie2_death"+a,"./sprites/zombie_02/death/zombiedeath2_"+a+".png");for(a=0;19>=a;a++)s_oSpriteLibrary.addSprite("zombie2_run"+a,"./sprites/zombie_02/run/zombierun2_"+a+".png");for(a=
0;57>=a;a++)s_oSpriteLibrary.addSprite("zombie3_death"+a,"./sprites/zombie_03/death/zombiedeath3_"+a+".png");for(a=0;20>=a;a++)s_oSpriteLibrary.addSprite("zombie3_run"+a,"./sprites/zombie_03/run/zombierun3_"+a+".png");for(a=0;57>=a;a++)s_oSpriteLibrary.addSprite("survivor_death"+a,"./sprites/survivor/death/survivordeath_"+a+".png");for(a=0;16>=a;a++)s_oSpriteLibrary.addSprite("survivor_run"+a,"./sprites/survivor/run/survivorrun_"+a+".png");d+=s_oSpriteLibrary.getNumSprites();s_oSpriteLibrary.loadSprites()};
this._onImagesLoaded=function(){b++;g.refreshLoader(Math.floor(b/d*100))};this._onAllImagesLoaded=function(){};this._onRemovePreloader=function(){g.unload();s_oSoundTrack=playSound("soundtrack",1,!0);this.gotoMenu()};this.gotoMenu=function(){new CMenu;f=STATE_MENU};this.gotoGame=function(){k=new CGame(n);f=STATE_GAME};this.gotoHelp=function(){new CHelp;f=STATE_HELP};this.stopUpdate=function(){c=!1;createjs.Ticker.paused=!0;$("#block_game").css("display","block");Howler.mute(!0)};this.startUpdate=
function(){s_iPrevTime=(new Date).getTime();c=!0;createjs.Ticker.paused=!s_bPlayActive;$("#block_game").css("display","none");s_bAudioActive&&Howler.mute(!1)};this._update=function(a){if(!1!==c){var b=(new Date).getTime();s_iTimeElaps=b-s_iPrevTime;s_iCntTime+=s_iTimeElaps;s_iCntFps++;s_iPrevTime=b;1E3<=s_iCntTime&&(s_iCurFps=s_iCntFps,s_iCntTime-=1E3,s_iCntFps=0);f===STATE_GAME&&k.update();s_oStage.update(a)}};s_oMain=this;var n=a;ENABLE_CHECK_ORIENTATION=a.check_orientation;ENABLE_FULLSCREEN=a.fullscreen;
s_bAudioActive=n.audio_enable_on_startup;this.initContainer()}var s_bMobile,s_bAudioActive=!1,s_bPlayActive=!0,s_iCntTime=0,s_iTimeElaps=0,s_iPrevTime=0,s_iCntFps=0,s_iCurFps=0,s_oDrawLayer,s_oStage,s_oMain,s_oSpriteLibrary,s_oSoundTrack,s_aSounds,s_aSoundsInfo,s_oCanvas,s_bFullscreen=!1;
function CTextButton(a,c,b,d,f,g,k,n){var l,m,w,v,r,y,z,h,x,A;this._init=function(a,b,c,d,g,f,k){l=!1;m=1;w=[];v=[];A=createBitmap(c);h=new createjs.Container;h.x=a;h.y=b;h.regX=c.width/2;h.regY=c.height/2;s_bMobile||(h.cursor="pointer");h.addChild(A,x);n.addChild(h);x=new CTLText(h,40,0,c.width-80,c.height,k,"center",f,g,1,2,2,d,!0,!0,!1,!1);this._initListener()};this.unload=function(){h.off("mousedown",r);h.off("pressup",y);n.removeChild(h)};this.setVisible=function(a){h.visible=a};this.setAlign=
function(a){x.textAlign=a};this.setTextX=function(a){x.x=a};this.setScale=function(a){m=h.scaleX=h.scaleY=a};this.enable=function(){l=!1};this.disable=function(){l=!0};this._initListener=function(){r=h.on("mousedown",this.buttonDown);y=h.on("pressup",this.buttonRelease)};this.addEventListener=function(a,b,c){w[a]=b;v[a]=c};this.addEventListenerWithParams=function(a,b,c,d){w[a]=b;v[a]=c;z=d};this.buttonRelease=function(){l||(playSound("click",1,!1),h.scaleX=m,h.scaleY=m,w[ON_MOUSE_UP]&&w[ON_MOUSE_UP].call(v[ON_MOUSE_UP],
z))};this.buttonDown=function(){l||(h.scaleX=.9*m,h.scaleY=.9*m,w[ON_MOUSE_DOWN]&&w[ON_MOUSE_DOWN].call(v[ON_MOUSE_DOWN]))};this.setPosition=function(a,b){h.x=a;h.y=b};this.tweenPosition=function(a,b,c,d,g,f,k){createjs.Tween.get(h).wait(d).to({x:a,y:b},c,g).call(function(){void 0!==f&&f.call(k)})};this.changeText=function(a){x.refreshText(a)};this.setX=function(a){h.x=a};this.setY=function(a){h.y=a};this.getButtonImage=function(){return h};this.getX=function(){return h.x};this.getY=function(){return h.y};
this.getSprite=function(){return h};this.getScale=function(){return h.scaleX};this._init(a,c,b,d,f,g,k)}
function CToggle(a,c,b,d,f){var g,k,n,l,m,w,v;this._init=function(a,b,c,d,f){m=[];w=[];var k=new createjs.SpriteSheet({images:[c],frames:{width:c.width/2,height:c.height,regX:c.width/2/2,regY:c.height/2},animations:{state_true:[0],state_false:[1]}});g=d;v=createSprite(k,"state_"+g,c.width/2/2,c.height/2,c.width/2,c.height);v.x=a;v.y=b;v.stop();f.addChild(v);this._initListener()};this.unload=function(){s_bMobile?v.off("mousedown",k):(v.off("mousedown",k),v.off("mouseover",l));v.off("pressup",n);f.removeChild(v)};
this._initListener=function(){s_bMobile?k=v.on("mousedown",this.buttonDown):(k=v.on("mousedown",this.buttonDown),l=v.on("mouseover",this.buttonOver));n=v.on("pressup",this.buttonRelease)};this.addEventListener=function(a,b,c){m[a]=b;w[a]=c};this.setActive=function(a){g=a;v.gotoAndStop("state_"+g)};this.buttonRelease=function(){v.scaleX=1;v.scaleY=1;playSound("click",1,!1);g=!g;v.gotoAndStop("state_"+g);m[ON_MOUSE_UP]&&m[ON_MOUSE_UP].call(w[ON_MOUSE_UP],g)};this.buttonDown=function(){v.scaleX=.9;v.scaleY=
.9;m[ON_MOUSE_DOWN]&&m[ON_MOUSE_DOWN].call(w[ON_MOUSE_DOWN])};this.buttonOver=function(a){s_bMobile||(a.target.cursor="pointer")};this.setPosition=function(a,b){v.x=a;v.y=b};this._init(a,c,b,d,f)}
function CGfxButton(a,c,b,d){var f,g,k,n,l=[],m,w,v,r;this._init=function(a,b,c,d){f=!1;g=1;k=[];n=[];r=createBitmap(c);r.x=a;r.y=b;r.scaleX=r.scaleY=g;r.regX=c.width/2;r.regY=c.height/2;d.addChild(r);this._initListener()};this.unload=function(){r.off("mousedown",m);r.off("pressup",w);s_bMobile||r.off("mouseover",v);d.removeChild(r)};this.setVisible=function(a){r.visible=a};this.setClickable=function(a){f=!a};this._initListener=function(){m=r.on("mousedown",this.buttonDown);w=r.on("pressup",this.buttonRelease);
s_bMobile||(v=r.on("mouseover",this.buttonOver))};this.addEventListener=function(a,b,c){k[a]=b;n[a]=c};this.addEventListenerWithParams=function(a,b,c,d){k[a]=b;n[a]=c;l=d};this.buttonRelease=function(){f||(r.scaleX=g,r.scaleY=g,k[ON_MOUSE_UP]&&k[ON_MOUSE_UP].call(n[ON_MOUSE_UP],l))};this.buttonDown=function(){f||(r.scaleX=.9*g,r.scaleY=.9*g,playSound("click",1,!1),k[ON_MOUSE_DOWN]&&k[ON_MOUSE_DOWN].call(n[ON_MOUSE_DOWN],l))};this.buttonOver=function(a){s_bMobile||f||(a.target.cursor="pointer")};this.pulseAnimation=
function(){createjs.Tween.get(r).to({scaleX:1.1*g,scaleY:1.1*g},850,createjs.Ease.quadOut).to({scaleX:g,scaleY:g},650,createjs.Ease.quadIn).call(function(){y.pulseAnimation()})};this.trembleAnimation=function(){createjs.Tween.get(r).to({rotation:5},75,createjs.Ease.quadOut).to({rotation:-5},140,createjs.Ease.quadIn).to({rotation:0},75,createjs.Ease.quadIn).wait(750).call(function(){y.trebleAnimation()})};this.setPosition=function(a,b){r.x=a;r.y=b};this.setX=function(a){r.x=a};this.setY=function(a){r.y=
a};this.getButtonImage=function(){return r};this.getX=function(){return r.x};this.getY=function(){return r.y};var y=this;this._init(a,c,b,d);return this}
function CMenu(){var a,c,b,d,f,g,k,n,l,m,w,v,r,y,z=null,h=null;this._init=function(){l=createBitmap(s_oSpriteLibrary.getSprite("bg_menu"));s_oStage.addChild(l);f=CANVAS_WIDTH/2;g=CANVAS_HEIGHT-75;var x=s_oSpriteLibrary.getSprite("but_play");m=new CTextButton(f,g,x,TEXT_PLAY,PRIMARY_FONT,"#ffffff",50,s_oStage);m.addEventListener(ON_MOUSE_UP,this._onButPlayRelease,this);if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)x=s_oSpriteLibrary.getSprite("audio_icon"),k=CANVAS_WIDTH-x.height/2-10,n=x.height/2+
10,v=new CToggle(k,n,x,s_bAudioActive,s_oStage),v.addEventListener(ON_MOUSE_UP,this._onAudioToggle,this);x=s_oSpriteLibrary.getSprite("but_credits");b=x.width/2+10;d=x.height/2+10;r=new CGfxButton(b,d,x,s_oStage);r.addEventListener(ON_MOUSE_UP,this._onCreditsBut,this);x=window.document;var A=x.documentElement;z=A.requestFullscreen||A.mozRequestFullScreen||A.webkitRequestFullScreen||A.msRequestFullscreen;h=x.exitFullscreen||x.mozCancelFullScreen||x.webkitExitFullscreen||x.msExitFullscreen;!1===ENABLE_FULLSCREEN&&
(z=!1);z&&screenfull.enabled&&(x=s_oSpriteLibrary.getSprite("but_fullscreen"),a=b+x.width/2+10,c=x.height/2+10,y=new CToggle(a,c,x,s_bFullscreen,s_oStage),y.addEventListener(ON_MOUSE_UP,this._onFullscreenRelease,this));w=new createjs.Shape;w.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);s_oStage.addChild(w);createjs.Tween.get(w).to({alpha:0},1E3).call(function(){w.visible=!1});this.refreshButtonPos(s_iOffsetX,s_iOffsetY)};this.refreshButtonPos=function(l,h){!1!==DISABLE_SOUND_MOBILE&&
!1!==s_bMobile||v.setPosition(k-l,h+n);r.setPosition(b+l,h+d);m.setPosition(f,-h+g);z&&screenfull.enabled&&y.setPosition(a+l,c+h)};this.unload=function(){m.unload();m=null;r.unload();if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)v.unload(),v=null;z&&screenfull.enabled&&y.unload();s_oStage.removeChild(l);s_oMenu=l=null};this._onAudioToggle=function(){Howler.mute(s_bAudioActive);s_bAudioActive=!s_bAudioActive};this._onCreditsBut=function(){new CCreditsPanel};this.resetFullscreenBut=function(){z&&screenfull.enabled&&
y.setActive(s_bFullscreen)};this._onFullscreenRelease=function(){s_bFullscreen?h.call(window.document):z.call(window.document.documentElement);sizeHandler()};this._onButPlayRelease=function(){this.unload();$(s_oMain).trigger("start_session");s_oMain.gotoGame()};s_oMenu=this;this._init()}var s_oMenu=null;
function CPausePanel(a){var c,b,d,f;this._init=function(a){c=new createjs.Shape;c.graphics.beginFill("rgba(0,0,0,0.7)").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);b=new createjs.Text(TEXT_PAUSE," 150px "+PRIMARY_FONT,"#ffffff");b.x=CANVAS_WIDTH/2+4;b.y=CANVAS_HEIGHT/2+4;b.textAlign="center";b.textBaseline="middle";d=new createjs.Text(TEXT_PAUSE," 150px "+PRIMARY_FONT,"#ff0000");d.x=CANVAS_WIDTH/2;d.y=CANVAS_HEIGHT/2;d.textAlign="center";d.textBaseline="middle";f=new createjs.Container;f.visible=!1;
f.addChild(c,b,d);a.addChild(f)};this.unload=function(){a.removeChild(f)};this.show=function(a){f.visible=a};this._init(a)}
function CGame(a){function c(a){80===a.keyCode&&s_oInterface.pressPauseButton()}var b,d,f,g,k,n,l,m,w,v,r,y,z=!1,h=!1,x,A,G,I=null,E,D,H,L,p,u,M,F,J;this._init=function(){m=g=f=0;k=SPAWN_TIME;n=STAGE_START_TIME;r=b=l=0;d=PLAYER_LIFE;y=0;F=[];M=[];this._setProbability();var a=createBitmap(s_oSpriteLibrary.getSprite("bg_game"));s_oStage.addChild(a);w=s_oStage.getChildIndex(a);u=[];E=new createjs.Container;s_oStage.addChild(E);a=s_oSpriteLibrary.getSprite("bridge");var h=createBitmap(a);D=new createjs.Container;
D.regY=a.height;D.y=CANVAS_HEIGHT;s_oStage.addChild(D);D.addChild(h);a=(new createjs.Graphics).beginFill("rgba(158,158,158,0.01)").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT-a.height);J=new createjs.Shape(a);J.on("mousedown",this._onShoot);s_oStage.addChild(J);x=new createjs.Text("","60px "+PRIMARY_FONT,"#ffffff");x.x=CANVAS_WIDTH/2+2;x.y=-98;x.textAlign="center";s_oStage.addChild(x);A=new createjs.Text("","60px "+PRIMARY_FONT,"#fe0000");A.x=CANVAS_WIDTH/2;A.y=-100;A.textAlign="center";s_oStage.addChild(A);
p=new CPausePanel(s_oStage);G=new CInterface;H=new createjs.Shape;H.graphics.beginFill("rgba(255,0,0,1)").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);H.alpha=0;s_oStage.addChild(H);L=new createjs.Shape;L.graphics.beginFill("rgba(0,255,0,1)").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);L.alpha=0;s_oStage.addChild(L);new CHelpPanel;s_bMobile||(document.onkeydown=c)};this.tryShowAd=function(){y++;y===AD_SHOW_COUNTER&&(y=0,$(s_oMain).trigger("show_interlevel_ad"))};this.unload=function(){z=!1;createjs.Tween.removeAllTweens();
s_oStage.removeAllChildren();stopSound("zombie_crowd");setVolume("soundtrack",1);G.unload();null!==I&&I.unload()};this.onExit=function(){createjs.Ticker.paused=!1;s_bPlayActive=!0;this.unload();s_oMain.gotoMenu();$(s_oMain).trigger("end_session");$(s_oMain).trigger("end_level",r);$(s_oMain).trigger("show_interlevel_ad")};this._onExitHelp=function(){z=!0;this.newStage();setVolume("soundtrack",SOUNDTRACK_VOLUME_IN_GAME);playSound("zombie_crowd",1,!0);setVolume("zombie_crowd",1)};this.pauseGame=function(){(s_bPlayActive=
!s_bPlayActive)?(z=!0,p.show(!1),createjs.Ticker.paused=!1):(z=!1,p.show(!0),createjs.Ticker.paused=!0)};this.gameOver=function(){setVolume("soundtrack",1);I=new CEndPanel(s_oSpriteLibrary.getSprite("game_over_bg"));I.show(b)};this.getBgDepth=function(){return w};this._onShoot=function(a){var b=a.stageX/s_iScaleFactor;a=a.stageY/s_iScaleFactor;for(var c,d=F.length-1;0<=d;d--)if(c=F[d].zombie.getRect(),c.contains(b,a)&&"death"!==F[d].zombie.getState()){F[d].zombie.hitZombie();break}};this.subtractLife=
function(a){d+=DAMAGE[a];0>=d?(z=!1,createjs.Tween.removeAllTweens(),this.gameOver()):d>PLAYER_LIFE&&(d=PLAYER_LIFE);G.refreshBar(d/PLAYER_LIFE+.001);4===a?createjs.Tween.get(L,{override:!0}).to({alpha:.5},150,createjs.Ease.linear).to({alpha:0},150,createjs.Ease.linear):createjs.Tween.get(H,{override:!0}).to({alpha:.6},150,createjs.Ease.linear).to({alpha:0},150,createjs.Ease.linear)};this.updateScore=function(a){b+=SCORE[a];0>b&&(b=0);G.refreshScore(b)};this._checkHit=function(a,b){for(var c=0;c<
u.length;c++)a>u[c].target().x&&a<u[c].target().x+u[c].target().w&&b>u[c].target().y&&b<u[c].target().y+u[c].target().h&&u[c].kill(),u[c].checkGone()&&u.splice(c,1)};this._setProbability=function(){l===ZOMBIE_ON_STAGE.length&&l--;M=[];for(var a=0;a<ZOMBIE_ON_STAGE[l].length;a++)for(var b=0;b<ZOMBIE_ON_STAGE[l][a];b++)M.push(a);v=SURVIVOR_ON_STAGE[l]};this._sortZombie=function(){for(var a=0;a<u.length;a++)F[a]={y:u[a].getPos().y,zombie:u[a]},u[a].checkGone()&&u.splice(a,1);F.sort(function(a,b){return a.y<
b.y?-1:a.y>b.y?1:0});for(a=0;a<F.length;a++){var b=F[a].zombie;b.scaleMe(8.57143E-4*F[a].y+.442857);"run"===b.getState()?E.setChildIndex(b.getContainerRun(),a):E.setChildIndex(b.getContainerDeath(),a)}};this._spawnZombie=function(){var a=Math.ceil(Math.random()*MAX_SPAWN[m]);for(var b=0;b<a;b++){var c=Math.random()*START_SIZE+MAX_START_TOP;var d=Math.random()*END_SIZE+MAX_END_TOP;var g=Math.floor(300*Math.random());var e=Math.floor(Math.random()*M.length);u.push(new CCharacter(M[e],c,d,g,E))}};this._spawnSurvivor=
function(){if(100*Math.random()<v){var a=Math.random()*START_SIZE+MAX_START_TOP;var b=Math.random()*END_SIZE+MAX_END_TOP;var c=Math.floor(200*Math.random());u.push(new CCharacter(4,a,b,c,E))}};this.newStage=function(){this.tryShowAd();r++;$(s_oMain).trigger("start_level",r);A.text=TEXT_WAVE+" "+r;x.text=TEXT_WAVE+" "+r;createjs.Tween.get(A).to({y:CANVAS_HEIGHT/2-220},2E3,createjs.Ease.bounceOut).to({alpha:0},2E3,createjs.Ease.linear);createjs.Tween.get(x).to({y:CANVAS_HEIGHT/2-218},2E3,createjs.Ease.bounceOut).to({alpha:0},
2E3,createjs.Ease.linear).call(function(){N._removeTweens()});s_oGame.startStage()};this._removeTweens=function(){A.alpha=1;A.y=-100;x.alpha=1;x.y=-98;createjs.Tween.removeTweens(A);createjs.Tween.removeTweens(x)};this.startStage=function(){z=!0;h=!1};this.update=function(){if(z){g+=s_iTimeElaps;!1===h&&(g>n?(g=0,l++,m++,m===MAX_SPAWN.length&&m--,this._setProbability(),n+=STAGE_TIME_INCREASE,550<k&&(k-=SPAWN_TIME_DECREASE),h=!0):(f+=s_iTimeElaps,f>k&&(f=0,this._spawnZombie(),this._spawnSurvivor())));
for(var a=0;a<u.length;a++)u[a].update();h&&0===u.length&&(z=!1,E.removeAllChildren(),this.newStage(r));this._sortZombie()}};s_oGame=this;PLAYER_LIFE=a.playerlife;DAMAGE[0]=a.damage_zombie_0;DAMAGE[1]=a.damage_zombie_1;DAMAGE[2]=a.damage_zombie_2;DAMAGE[3]=a.damage_zombie_3;DAMAGE[4]=a.damage_survivor;LIFE[0]=a.life_zombie_0;LIFE[1]=a.life_zombie_1;LIFE[2]=a.life_zombie_2;LIFE[3]=a.life_zombie_3;LIFE[4]=a.life_survivor;SCORE[0]=a.score_zombie_0;SCORE[1]=a.score_zombie_1;SCORE[2]=a.score_zombie_2;
SCORE[3]=a.score_zombie_3;SCORE[4]=a.score_survivor;SPAWN_TIME=a.start_spawn_time;SPAWN_TIME_DECREASE=a.spawn_time_decrease;STAGE_START_TIME=a.stage_start_time;STAGE_TIME_INCREASE=a.stage_time_increase;MAX_SPAWN=a.max_spawn_onstages;ZOMBIE_ON_STAGE[0]=a.zombie_rate_onstage_0;ZOMBIE_ON_STAGE[1]=a.zombie_rate_onstage_1;ZOMBIE_ON_STAGE[2]=a.zombie_rate_onstage_2;ZOMBIE_ON_STAGE[3]=a.zombie_rate_onstage_3;ZOMBIE_ON_STAGE[4]=a.zombie_rate_onstage_4;ZOMBIE_ON_STAGE[5]=a.zombie_rate_onstage_5;ZOMBIE_ON_STAGE[6]=
a.zombie_rate_onstage_6;ZOMBIE_ON_STAGE[7]=a.zombie_rate_onstage_7;SURVIVOR_ON_STAGE=a.survivor_rate_onstages;AD_SHOW_COUNTER=a.ad_show_counter;var N=this;this._init()}var s_oGame;
function CInterface(){var a,c,b,d,f,g,k,n,l,m,w,v,r,y,z,h,x,A,G,I,E,D,H=null,L=null;this._init=function(){var p,u=s_oSpriteLibrary.getSprite("but_exit");w=CANVAS_WIDTH-u.height/2-10;v=u.height/2+10;y=new CGfxButton(w,v,u,s_oStage);y.addEventListener(ON_MOUSE_UP,this._onExit,this);l=p=CANVAS_WIDTH-u.width/2-80;m=u.height/2+10;if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)u=s_oSpriteLibrary.getSprite("audio_icon"),r=new CToggle(l,m,u,s_bAudioActive,s_oStage),r.addEventListener(ON_MOUSE_UP,this._onAudioToggle,
this),p=CANVAS_WIDTH-u.width/2-130;k=p;n=u.height/2+10;u=s_oSpriteLibrary.getSprite("pause_icon");z=new CToggle(k,n,u,!0,s_oStage);z.addEventListener(ON_MOUSE_UP,this._onPauseToggle,this);u=window.document;p=u.documentElement;H=p.requestFullscreen||p.mozRequestFullScreen||p.webkitRequestFullScreen||p.msRequestFullscreen;L=u.exitFullscreen||u.mozCancelFullScreen||u.webkitExitFullscreen||u.msExitFullscreen;!1===ENABLE_FULLSCREEN&&(H=!1);H&&screenfull.enabled&&(u=s_oSpriteLibrary.getSprite("but_fullscreen"),
a=k-u.width/2-28,c=u.height/2+10,D=new CToggle(a,c,u,s_bFullscreen,s_oStage),D.addEventListener(ON_MOUSE_UP,this._onFullscreenRelease,this));f=30;g=800;I=new createjs.Container;I.x=f;I.y=g;s_oStage.addChild(I);h=new createjs.Text(TEXT_SCORE,"45px "+PRIMARY_FONT,"#fff2af");h.textBaseline="textBaseline";I.addChild(h);x=new createjs.Text("0","45px "+PRIMARY_FONT,"#fff2af");x.x=170;x.textBaseline="textBaseline";I.addChild(x);b=750;d=800;E=new createjs.Container;E.x=b;E.y=d;s_oStage.addChild(E);A=new createjs.Text(TEXT_HEALTH,
"40px "+PRIMARY_FONT,"#fff2af");A.x=360;A.textAlign="right";A.textBaseline="textBaseline";E.addChild(A);u=s_oSpriteLibrary.getSprite("energy_bar_fill");p=createBitmap(u);p.x=5;p.y=5;E.addChild(p);u=s_oSpriteLibrary.getSprite("energy_bar_bg");var M=createBitmap(u);E.addChild(M);G=new createjs.Shape;G.graphics.beginFill("rgba(255,0,0,0.01)").drawRect(0,0,u.width,u.height);G.x=5;G.y=5;E.addChild(G);p.mask=G;this.refreshButtonPos(s_iOffsetX,s_iOffsetY)};this.refreshButtonPos=function(h,u){y.setPosition(w-
h,u+v);!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||r.setPosition(l-h,u+m);z.setPosition(k-h,u+n);I.x=f+h;I.y=g-u;E.x=b-h;E.y=d-u;H&&screenfull.enabled&&D.setPosition(a+h,c+u)};this.refreshBar=function(a){createjs.Tween.get(G,{override:!0}).to({scaleX:a},250,createjs.Ease.linear)};this.refreshScore=function(a){x.text=a};this.unload=function(){if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)r.unload(),r=null;s_oInterface=null;H&&screenfull.enabled&&D.unload()};this.resetFullscreenBut=function(){H&&screenfull.enabled&&
D.setActive(s_bFullscreen)};this._onFullscreenRelease=function(){s_bFullscreen?L.call(window.document):H.call(window.document.documentElement);sizeHandler()};this._onAudioToggle=function(){Howler.mute(s_bAudioActive);s_bAudioActive=!s_bAudioActive};this._onPauseToggle=function(){s_oGame.pauseGame()};this.pressPauseButton=function(){z.buttonRelease()};this._onExit=function(){s_oGame.onExit()};s_oInterface=this;this._init();return this}var s_oInterface=null;
function CHelpPanel(){var a,c,b,d;this._init=function(){d=new createjs.Container;s_oStage.addChild(d);b=createBitmap(s_oSpriteLibrary.getSprite("msg_box"));d.addChild(b);a=createBitmap(s_oSpriteLibrary.getSprite("survivor_run10"));a.x=CANVAS_WIDTH/2-180;a.y=CANVAS_HEIGHT/2-90;a.scaleX=a.scaleY=.7;d.addChild(a);c=createBitmap(s_oSpriteLibrary.getSprite("zombie0_run22"));c.x=CANVAS_WIDTH/2+100;c.y=CANVAS_HEIGHT/2-120;c.scaleX=c.scaleY=.85;d.addChild(c);var f=250,g=50,k=CANVAS_WIDTH/2+140,n=CANVAS_HEIGHT/
2-120;new CTLText(d,k-f/2,n-g/2,f,g,22,"center","#fff2af",PRIMARY_FONT,1,2,2,TEXT_HELP1,!0,!0,!0,!1);f=250;g=50;k=CANVAS_WIDTH/2-140;n=CANVAS_HEIGHT/2-120;new CTLText(d,k-f/2,n-g/2,f,g,22,"center","#fff2af",PRIMARY_FONT,1,2,2,TEXT_HELP2,!0,!0,!0,!1);f=500;g=70;k=CANVAS_WIDTH/2;n=CANVAS_HEIGHT/2+120;new CTLText(d,k-f/2,n-g/2,f,g,36,"center","#fff2af",PRIMARY_FONT,1,2,2,TEXT_HELP2,!0,!0,!0,!1);var l=this;d.on("pressup",function(){l._onExitHelp()})};this.unload=function(){s_oStage.removeChild(d);var a=
this;d.off("pressup",function(){a._onExitHelp()})};this._onExitHelp=function(){this.unload();s_oGame._onExitHelp()};this._init()}
function CEndPanel(a){var c,b,d,f;this._init=function(a){b=new createjs.Container;b.alpha=0;b.visible=!1;s_oStage.addChild(b);c=createBitmap(a);b.addChild(c);a=500;var g=70,n=CANVAS_WIDTH/2,l=CANVAS_HEIGHT/2-100;d=new CTLText(b,n-a/2,l-g/2,a,g,60,"center","#fff2af",PRIMARY_FONT,1,2,2,"",!0,!0,!0,!1);a=500;g=50;n=CANVAS_WIDTH/2;l=CANVAS_HEIGHT/2+50;f=new CTLText(b,n-a/2,l-g/2,a,g,40,"center","#fff2af",PRIMARY_FONT,1,2,2,"",!0,!0,!0,!1)};this.unload=function(){b.off("mousedown",this._onExit)};this._initListener=
function(){b.on("mousedown",this._onExit)};this.show=function(a){d.refreshText(TEXT_GAMEOVER);f.refreshText(TEXT_SCORE+": "+a);b.visible=!0;var c=this;createjs.Tween.get(b).to({alpha:1},500).call(function(){c._initListener()});$(s_oMain).trigger("save_score",a);$(s_oMain).trigger("share_event",a)};this._onExit=function(){b.off("mousedown",this._onExit);s_oStage.removeChild(b);s_oGame.onExit()};this._init(a);return this}
function CCharacter(a,c,b,d,f){var g,k,n,l,m,w,v,r,y,z,h,x,A=!0,G=!1,I,E,D=1,H,L,p,u,M,F,J,N;this._init=function(a,b,c,d,e){N=e;I=DEATH_FRAMES[a];E=RUN_FRAMES[a];x=!0;k="run";g=0;F=[];J=[];n=new createjs.Container;l=new createjs.Container;m=new createjs.Container;c=4===a?"survivor_death":"zombie"+a+"_death";for(var f=0;f<=I;f++)F[f]=createBitmap(s_oSpriteLibrary.getSprite(c+f)),F[f].visible=!1,l.addChild(F[f]);c=4===a?"survivor_run":"zombie"+a+"_run";for(f=0;f<=E;f++)J[f]=createBitmap(s_oSpriteLibrary.getSprite(c+
f)),J[f].visible=!1,n.addChild(J[f]);c=s_oSpriteLibrary.getSprite(4===a?"survivor_run"+a:"zombie"+a+"_run"+a);n.regX=c.width/2;n.regY=c.height;u=c.width;M=c.height;c=s_oSpriteLibrary.getSprite(4===a?"survivor_death"+a:"zombie"+a+"_death"+a);l.regX=c.width/2;l.regY=c.height;l.visible=!1;e.addChild(n);e.addChild(l);n.x=CANVAS_WIDTH+n.regX+d;n.y=b;w=CORRECTION[a];y=BAR_POS[a];H=LIFE[a];a=s_oSpriteLibrary.getSprite("enemy_bar_bg");v=createBitmap(a);v.x=y.x;v.y=y.y;m.addChild(v);a=s_oSpriteLibrary.getSprite("enemy_bar_fill");
r=createBitmap(a);r.x=y.x+4;r.y=y.y+4;m.addChild(r);z=new createjs.Shape;z.graphics.beginFill("rgba(255,0,0,0.01)").drawRect(0,0,a.width,a.height);z.regX=a.width;z.regY=a.height;z.x=y.x+a.width+4;z.y=y.y+a.height+4;m.addChild(z);r.mask=z;m.alpha=0;n.addChild(m);a=s_oSpriteLibrary.getSprite("blood_floor");h=createBitmap(a);h.regX=a.width/2;h.regY=a.height/2;h.alpha=0;p=s_oGame.getBgDepth()+1};this.unload=function(){N.removeChild(n);N.removeChild(l)};this.getRect=function(){return new createjs.Rectangle(n.x-
u/2*n.scaleX+w.x*n.scaleX,n.y-M*n.scaleY+w.y*n.scaleY,w.w*n.scaleX,w.h*n.scaleY)};this.hitZombie=function(){s_bPlayActive&&(H--,m.alpha=1,L=H/LIFE[a]+.001,playSound("tap_zombie",1,!1),createjs.Tween.get(z).to({scaleY:L},150,createjs.Ease.linear),createjs.Tween.get(m,{override:!0}).to({alpha:0},1E3,createjs.Ease.linear),0===H&&Q.kill())};this.scaleMe=function(a){n.scaleX=a;n.scaleY=a};this._getScale=function(){return n.scaleX};this._animRun=function(){0===D?(J[E].visible=!1,J[0].visible=!0):(J[D-1].visible=
!1,J[D].visible=!0);D++;D>E&&(D=0)};this._bloodOnFloor=function(){h.x=l.x-OFFSET_BLOOD[a].x;h.y=l.y-OFFSET_BLOOD[a].y;h.scaleX=l.scaleX;h.scaleY=l.scaleY;h.rotation=Math.floor(360*Math.random());s_oStage.addChild(h);s_oStage.setChildIndex(h,p);createjs.Tween.get(h).to({alpha:1},200,createjs.Ease.linear)};this._animDeath=function(){0===D?(J[0].visible=!0,this._bloodOnFloor()):(F[D-1].visible=!1,F[D].visible=!0);D++;D>I&&(x=!1,createjs.Tween.get(F[D-1]).to({alpha:0},2500,createjs.Ease.linear).call(function(){Q._isDead()}),
createjs.Tween.get(h).to({alpha:0},15E3,createjs.Ease.linear))};this.kill=function(){"run"===k&&(4===a&&playSound("survivor_scream",1,!1),k="death",s_oGame.updateScore(a),createjs.Tween.removeTweens(n),l.x=n.x-OFFSET_ANIMATION[a],l.y=n.y,l.scaleX=this._getScale(),l.scaleY=this._getScale(),D=0,l.addChild(m),1===a&&(m.regX=y.x),m.x=y.x,createjs.Tween.get(m).to({alpha:0},500,createjs.Ease.linear),n.visible=!1,N.removeChild(n),l.visible=!0,F[0].visible=!0)};this._isDead=function(){G=!0;this.unload()};
this._isGone=function(){G=!0;this.unload();s_oGame.subtractLife(a)};this.checkGone=function(){return G};this._move=function(){createjs.Tween.get(n).to({x:-n.regX,y:b},SPEED[a],createjs.Ease.linear).call(function(){Q._isGone()})};this.getPos=function(){return{x:n.x,y:n.y}};this.getContainerRun=function(){return n};this.getContainerDeath=function(){return l};this.getState=function(){return k};this.update=function(){if(x)switch(k){case "run":g===ANIM_DELAY[a]?(g=0,this._animRun()):g++;break;case "death":this._animDeath()}A&&
(this._move(),A=!1)};var Q=this;this._init(a,c,b,d,f)}
function CCreditsPanel(){var a,c,b,d,f;this._init=function(){b=new createjs.Container;s_oStage.addChild(b);var g=s_oSpriteLibrary.getSprite("msg_box"),k=createBitmap(g);k.regX=g.width/2;k.regY=g.height/2;b.addChild(k);b.x=CANVAS_WIDTH/2;b.y=CANVAS_HEIGHT/2;a=b.on("click",function(){});g=350;k=40;new CTLText(b,-(g/2),-60-k/2,g,k,36,"center","#ffffff",PRIMARY_FONT,1,2,2,TEXT_DEVELOPED,!0,!0,!0,!1);g=350;k=40;new CTLText(b,-(g/2),70-k/2,g,k,36,"center","#ffffff",PRIMARY_FONT,1,2,2,"WebOas.is",
!0,!0,!0,!1);g=s_oSpriteLibrary.getSprite("ctl_logo");f=createBitmap(g);c=f.on("click",this._onLogoButRelease);f.regX=g.width/2;f.regY=g.height/2;b.addChild(f);g=s_oSpriteLibrary.getSprite("but_exit");d=new CGfxButton(234,-120,g,b);d.addEventListener(ON_MOUSE_UP,this.unload,this)};this.unload=function(){d.setClickable(!1);s_oStage.removeChild(b);d.unload();f.off("click",c);b.off("click",a)};this._onLogoButRelease=function(){window.open("https://weboas.is")};this._init()};