- Upright Arcade Machines
- Bar Top Arcade Machines
- Virtual Pinball Machine
- Jukebox Rewind
- Electronic Dartboards
- Frequently Asked Questions
- Our Location
- Contact Us
Arcade Rewind
Unit 1/20 Berriman Dr, Wangara WA 6065
1300 272 233
');/* Master container */var master = d.createElement('div');master.setAttribute('style','display:inline-block;position:relative;height:'+(pxs*270)+'px;width:'+(pxs*320)+'px;border-radius:'+(pxs*10)+'px;background:url('+backDropImage+') bottom center no-repeat;background-size:'+(pxs*320)+'px;background-color:'+screenColour+';-webkit-user-select:none;-moz-user-select:none;');d.getElementById('Invaders').appendChild(master);/* Main game container */var innerContainer = d.createElement('div');innerContainer.setAttribute('style','display:block;position:absolute;height:'+(pxs*254)+'px;width:'+(pxs*208)+'px;margin:auto;left:0;right:0;bottom:0;top:0;opacity:0.8;');master.appendChild(innerContainer);/* Invader only container - for ref only */var invaderContainer = d.createElement('div');invaderContainer.setAttribute('style','display:block;position:absolute;top:0px;left:0px;height:100%;width:100%;margin:0;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(invaderContainer);/* Game over container */var gameOverContainer = d.createElement('div');gameOverContainer.setAttribute('style','display:block;position:absolute;height:'+(7*pxs)+'px;width:'+(70*pxs)+'px;top:'+(48*pxs)+'px;left:'+(66*pxs)+'px;text-align:left;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(gameOverContainer);/* Running score container */var score = d.createElement('div');score.setAttribute('style','display:flex;position:absolute;width:auto;height:'+(7*pxs)+'px;top:'+(16*pxs)+'px;left:'+(20.5*pxs)+'px;');innerContainer.appendChild(score);/* High score container */var hiScore = d.createElement('div');hiScore.setAttribute('style','display:flex;position:absolute;width:auto;height:'+(7*pxs)+'px;top:'+(16*pxs)+'px;left:'+(81*pxs)+'px;');innerContainer.appendChild(hiScore);var topInfo = d.createElement('div');topInfo.setAttribute('style','display:block;position:absolute;height:'+(7*pxs)+'px;width:100%;margin:auto;left:0;right:0;top:0;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(topInfo);var scoreInfo = d.createElement('div');scoreInfo.setAttribute('style','display:block;position:absolute;height:'+(7*pxs)+'px;width:100%;top:'+(16*pxs)+'px;margin:auto;left:0;right:0;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(scoreInfo);var bottomInfo = d.createElement('div');bottomInfo.setAttribute('style','display:block;position:absolute;height:'+(10*pxs)+'px;width:100%;margin:auto;left:0;right:0;bottom:0;border-top:'+(pxs*0.7)+'px solid #00dd00;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(bottomInfo);var cannonsInfo = d.createElement('div');cannonsInfo.setAttribute('style', 'display:flex;align-items:flex-end;position:absolute;height:'+(8*pxs)+'px;width:58%;margin:auto;left:0;top:0;padding: 0px 0px 0px '+(5 * pxs)+'px;text-align:left;font-size:0;line-height:0;');bottomInfo.appendChild(cannonsInfo);var creditsInfo = d.createElement('div');creditsInfo.setAttribute('style','display:flex;align-items:flex-end;position:absolute;height:'+(8*pxs)+'px;width:39%;margin:auto;right:0;top:0;text-align:left;padding:0;font-size:0;line-height:0;');bottomInfo.appendChild(creditsInfo);/* Mother ship container */var motherContainer = d.createElement('div');motherContainer.setAttribute('style','display:flex;position:absolute;justify-content:center;align-items:center;height:'+(8*pxs)+'px;width:'+(24*pxs)+'px;transform:translate3d('+shipProps.x+'px, '+shipProps.y+'px, 0);padding:0;font-size:0;line-height:0;');innerContainer.appendChild(motherContainer);/* Bullet container */var bulletContainer = d.createElement('div');bulletContainer.setAttribute('style','display:block;position:absolute;height:'+(8*pxs)+'px;width:'+(3*pxs)+'px;transform:translate3d('+(pxs*19.5)+'px, '+(pxs*219)+'px, 0);padding:0;font-size:0;line-height:0;');innerContainer.appendChild(bulletContainer);/* Bullet explosion container */var bulletExpContainer = d.createElement('div');bulletExpContainer.setAttribute('style','display:none;position:absolute;height:'+(8*pxs)+'px;width:'+(8*pxs)+'px;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(bulletExpContainer);/* Bullet explosion container (top) */var bulletExpContainerT = d.createElement('div');bulletExpContainerT.setAttribute('style','display:none;position:absolute;height:'+(8*pxs)+'px;width:'+(8*pxs)+'px;padding:0;font-size:0;line-height:0;');innerContainer.appendChild(bulletExpContainerT);/* Cannon container */var cannonContainer = d.createElement('div');cannonContainer.setAttribute('style', 'display: block;'+'position: absolute;'+'height: '+(9 * pxs)+'px;'+'width: '+(16 * pxs)+'px;'+'transform: translate3d('+cannonProps.x+'px, '+cannonProps.y+'px, 0);'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');innerContainer.appendChild(cannonContainer);/* Bunker containers */var bnkrs = [];var bx = 28 * pxs;for (var i = 0; i < 4; i++) {bnkrs[i] = d.createElement('div');bnkrs[i].setAttribute('id', 'bunker'+i);bnkrs[i].setAttribute('style','display:none;position:absolute;height:'+bunkerProps.h+'px;width:'+bunkerProps.w+'px;transform:translate3d('+bx+'px, '+bunkerProps.y+'px, 0);padding:0;font-size:0;line-height:0;');innerContainer.appendChild(bnkrs[i]);bx += (pxs * 43);}var expl = [];for (var i = 0; i < 4; i++) {expl[i] = d.createElement('div');expl[i].setAttribute('style','display:none;position:absolute;height:'+(8*pxs)+'px;width:'+(6*pxs)+'px;transform:translate3d(0px, 0px, 0);padding:0;font-size:0;line-height:0;');innerContainer.appendChild(expl[i]);}var aBomb = d.createElement('div');aBomb.setAttribute('style', 'display: none;'+'position: absolute;'+'height: '+(8 * pxs)+'px;'+'width: '+(3 * pxs)+'px;'+'transform: translate3d(0px, 0px, 0);'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');innerContainer.appendChild(aBomb);var bBomb = d.createElement('div');bBomb.setAttribute('style', 'display: none;'+'position: absolute;'+'height: '+(8 * pxs)+'px;'+'width: '+(3 * pxs)+'px;'+'transform: translate3d(0px, 0px, 0);'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');innerContainer.appendChild(bBomb);var cBomb = d.createElement('div');cBomb.setAttribute('style', 'display: none;'+'position: absolute;'+'height: '+(8 * pxs)+'px;'+'width: '+(3 * pxs)+'px;'+'transform: translate3d(0px, 0px, 0);'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');innerContainer.appendChild(cBomb);/* Alien containers */function initLayout() {for (var i = 0; i < 11; i++) {InvaderColumns[i] = [];}for (var i = 0; i < 55; i++) {tx += vSpacing;if (i % 11 == 0) {tx = xInit;ty += hSpacing;}var cells = d.createElement('div');cells.setAttribute('id', 'grd'+i);for (var j = 0; j < 11; j++) {if (i % 11 == j) {InvaderColumns[j].push(cells.id);}}cells.setAttribute('style','display:block;position:absolute;height:'+cellHeight+'px;width:'+cellWidth+'px;top:'+ty+'px;left:'+tx+'px;visibility:hidden;padding:0;font-size:0;line-height:0;');invaderContainer.appendChild(cells);}for (var i = 0; i < InvaderColumns.length; i++) {lowestInvaders.push(InvaderColumns[i][InvaderColumns[i].length - 1]);}}initLayout();/* Splash screen */var introFlash = d.createElement('div');introFlash.setAttribute('style','display:block;position:absolute;height:'+(210*pxs)+'px;width:100%;transform:translate3d(0px, '+(25*pxs)+'px, 0);padding:0;font-size:0;line-height:0;text-align:left;');innerContainer.appendChild(introFlash);var inf0 = d.createElement('div');inf0.setAttribute('id', 'flsh0');inf0.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:25%;left:'+(88.5*pxs)+'px;top:'+(32*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf0);var inf1 = d.createElement('div');inf1.setAttribute('id', 'flsh1');inf1.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:65%;left:'+(50.5*pxs)+'px;top:'+(56*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf1);var inf2 = d.createElement('div');inf2.setAttribute('id', 'flsh2');inf2.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:80%;left:'+(27.5*pxs)+'px;top:'+(89*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf2);var inf3 = d.createElement('div');inf3.setAttribute('id', 'flsh3');inf3.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:50%;left:'+(56.5*pxs)+'px;top:'+(108*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf3);var inf4 = d.createElement('div');inf4.setAttribute('id', 'flsh4');inf4.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:50%;left:'+(57.5*pxs)+'px;top:'+(127*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf4);var inf5 = d.createElement('div');inf5.setAttribute('id', 'flsh5');inf5.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:50%;left:'+(57.5*pxs)+'px;top:'+(146*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf5);var inf6 = d.createElement('div');inf6.setAttribute('id', 'flsh6');inf6.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:50%;left:'+(57.5*pxs)+'px;top:'+(165*pxs)+'px;font-size:0;line-height:0;');introFlash.appendChild(inf6);/* How to screen */var howToFlash = d.createElement('div');howToFlash.setAttribute('style','display:block;position:absolute;height:'+(210*pxs)+'px;width:100%;transform:translate3d(0px,'+(25*pxs)+'px, 0);padding:0;font-size:0;line-height:0;text-align:left;');innerContainer.appendChild(howToFlash);var how0 = d.createElement('div');how0.setAttribute('id', 'hwt0');how0.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:33%;left:'+(73.5*pxs)+'px;top:'+(32*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how0);var how1 = d.createElement('div');how1.setAttribute('id', 'hwt1');how1.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:75%;left:'+(28.0*pxs)+'px;top:'+(70*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how1);var how2 = d.createElement('div');how2.setAttribute('id', 'hwt2');how2.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:65%;left:'+(43.0*pxs)+'px;top:'+(89*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how2);var how3 = d.createElement('div');how3.setAttribute('id', 'hwt3');how3.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:80%;left:'+(27.5*pxs)+'px;top:'+(108*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how3);var how4 = d.createElement('div');how4.setAttribute('id', 'hwt4');how4.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:75%;left:'+(27.5*pxs)+'px;top:'+(146*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how4);var how5 = d.createElement('div');how5.setAttribute('id', 'hwt5');how5.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:10%;left:'+(96.0*pxs)+'px;top:'+(165*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how5);var how6 = d.createElement('div');how6.setAttribute('id', 'hwt6');how6.setAttribute('style','display:block;position:absolute;height:'+(9*pxs)+'px;width:40%;left:'+(65.5*pxs)+'px;top:'+(184*pxs)+'px;font-size:0;line-height:0;');howToFlash.appendChild(how6);function keyDown(e) {var c = cannonProps;if (e.keyCode == 13 && startGame) {return false;}if (e.keyCode == 13 && !startGame) {e.preventDefault();clearSplash();readyStart();startGame = true;}if (e.keyCode == 32 && initcontrols) { if (!startGame || fired) {return false;}else {if (marchOrder.length > 0 && !gameOver) {shoot();if (apiCapable) {decode1(cnnnFr);}}} }else {if (!startGame || c.active) {return false;}if (/3(?=2|7|9)/.test(e.keyCode)) {e.preventDefault();}c.active = true;if (e.keyCode == 39 && initcontrols) {c.right = true;}if (e.keyCode == 37 && initcontrols) {c.left = true;}cannonControl();}}//!function keyUp(e) {var c = cannonProps;if (/1|3(?=7|9)/.test(e.keyCode)) {clearTimeout(timers.cannon);c.active = false;c.right = false;c.left = false; }}//!function cannonControl() {var l = cannonProps;if (!l.active || marchOrder.length < 1 || gameOver || atZeroAlt || cannonHit) {return false;}if (l.right) {l.x += l.vel;}if (l.left) {l.x -= l.vel;}if (l.x < l.min) {l.x = l.min;}if (l.x > l.max) {l.x = l.max;}cannonContainer.style.transform = 'translate3d('+l.x+'px, '+l.y+'px, 0)';cannonCentre = l.x + (pxs * 7.5);timers.cannon = setTimeout(cannonControl,1000/60);}//!allowUser();window.addEventListener('keyup', keyUp, false);/* Add preceeding zeros to low scores */function preZeros(z,v) {var str = "";var zero = "generate(7,5,7,5,char.num[0],'char.num[0]','"+gameColour+"',"+v+");"for (var i = 0; i < z; i++) {str += zero;}return str;}//!function scoreBoard(n,v) {score.innerHTML = "";var genNumb = "";if (masterScore >= 10000) {masterScore -= 10000;}if (extraCannonScore >= 1500) {cannonCount++;if (apiCapable) {decode1(xtrCnnn);}extraCannonScore = 0;}Cannons(cannonCount);var a = n.toString();var b = a.split('');if (a.length == 1) {genNumb = preZeros(3,v);}if (a.length == 2) {genNumb = preZeros(2,v)}if (a.length == 3) {genNumb = preZeros(1,v)}for (var i = 0; i < b.length; i++) {genNumb += "generate(7,5,7,5,char.num["+parseInt(b[i])+"],'char.num["+parseInt(b[i])+"]','"+gameColour+"',"+v+");";}var eVal = new Function(genNumb);eVal();if (!isIELocal) {if (typeof(Storage) !== "undefined") {if (localStorage.score) {if (masterScore >= localStorage.score) {hiScore.innerHTML = score.innerHTML;localStorage.log = hiScore.innerHTML;}else{}}}}}//!function highScore() {if (!isIELocal) {if (typeof(Storage) !== "undefined") {if (localStorage.score) {var toNum = '';var tmp = localStorage.score.split('');for (var i = 0; i < tmp.length; i++) {toNum += tmp[i];}toNum = parseInt(toNum);scoreBoard(toNum,8);}if (!localStorage.score) {localStorage.score = 0;}if (localStorage.score == 0) {txt(0,8);txt(0,8);txt(0,8);txt(0,8);}}}else {txt(0,8);txt(0,8);txt(0,8);txt(0,8);}}//!highScore();/* Mothership mystery score */function mystery() {var a = ['50','100','150','300'];var b = a[Math.random() * a.length|0];masterScore += parseInt(b);if (masterScore >= 10000) {masterScore -= 10000;}extraCannonScore += parseInt(b);scoreBoard(masterScore,7);var c = b.split('');var genNumb = '';for (var i = 0; i < c.length; i++) {genNumb += "generate(7,5,7,5,char.num["+parseInt(c[i])+"],'char.num["+parseInt(c[i])+"]','"+motherShipColour+"',12);";}var eVal = new Function(genNumb);eVal();}//!/* Text generator */function txt(inp,dest) {var genNumb = "generate(7,5,7,5,char.num["+inp+"],'char.num["+inp+"]','"+gameColour+"','"+dest+"')";var genChar = "generate(7,5,7,5,char."+inp+",'char."+inp+"','"+gameColour+"','"+dest+"')";var rtrn = (typeof inp === 'number')?genNumb:genChar;var eVal = new Function(rtrn);eVal();}//!/* Permanent score markers */txt('s',5);txt('c',5);txt('o',5);txt('r',5);txt('e',5);txt('lbra',5);txt(1,5);txt('rbra',5);txt('blnk',5);txt('h',5);txt('i',5);txt('hyph',5);txt('s',5);txt('c',5);txt('o',5);txt('r',5);txt('e',5);txt('blnk',5);txt('s',5);txt('c',5);txt('o',5);txt('r',5);txt('e',5);txt('lbra',5);txt(2,5);txt('rbra',5);/* Score */txt(0,7);txt(0,7);txt(0,7);txt(0,7);/* Type text creator */function type(msg,dest) {var a = msg.split('');function doType() {if (a[counters.type] == ' ') {a[counters.type] = 'blnk';}txt(a[counters.type],dest);counters.type++;timers.type = setTimeout(function() {if (counters.type < a.length) {doType();}},110);if (counters.type >= a.length) {clearTimeout(timers.type);counters.type = 0;timers.type = null;}}doType();}//!function clearSplash() {stopFlash = true;counters.splash = 0;counters.ctrl = 0;introFlash.style.display = 'none';howToFlash.style.display = 'none';for (var i = 0; i < 7; i++) {d.getElementById('flsh'+i).innerHTML = '';d.getElementById('hwt'+i).innerHTML = '';}}function cntrls() {var a = [['p',26],['r',26],['e',26],['s',26],['s',26],['blnk',26],['e',26], ['n',26],['t',26],['e',26],['r',26],['blnk',26],['t',26], ['o',26],['blnk',26],['p',26],['l',26],['a',26],['y',26]];var b = [['r',26],['e',26],['l',26],['o',26],['a',26],['d',26],['blnk',26],['t',26],['o',26],['blnk',26],['p',26],['l',26],['a',26],['y',26],['blnk',26],['a',26],['g',26],['a',26],['i',26],['n',26]];var prt2 = (gameOver)?b:a;var prt1 = [['c',25],['o',25],['n',25],['t',25],['r',25],['o',25],['l',25],['s',25]];var prt3 = [['s',27],['p',27],['a',27],['c',27],['e',27],['b',27],['a',27],['r',27],['blnk',27],['hyph',27],['blnk',27],['s',27],['h',27],['o',27],['o',27],['t',27],['a',28],['r',28],['r',28],['o',28],['w',28],['s',28],['blnk',28],['k',28],['e',28],['y',28],['s',28],['blnk',28],['hyph',28],['blnk',28],['c',28],['a',28],['n',28],['n',28],['o',28],['n',28],['t',29],['a',29],['i',29],['t',29],['o',29],['blnk',29],['s',29],['p',29],['a',29],['c',29],['e',29],['blnk',29],['i',29],['n',29],['v',29],['a',29],['d',29],['e',29],['r',29],['s',29],['b',30],['y',30],['k',31],['u',31],['r',31],['t',31],['blnk',31],['g',31],['r',31],['i',31],['g',31],['g',31]];var msg = prt1.concat(prt2, prt3);return msg;}//!function ctrlScreen() {if (stopFlash){return false;}counters.splash = 0;var t = cntrls();txt(t[counters.ctrl][0],t[counters.ctrl][1]);counters.ctrl++;if (counters.ctrl < t.length) {setTimeout(runCtrl,110);}else {setTimeout(function() {howToFlash.style.display = 'none';for (var i = 0; i < 7; i++) {d.getElementById('hwt'+i).innerHTML = '';}introFlash.style.display = 'block';},3000);setTimeout(splashScreen,4000)}}//!function runCtrl() {ctrlScreen();}//!var splash = [['p',18],['l',18],['a',18],['y',18],['blnk',18], ['s',19],['p',19],['a',19],['c',19],['e',19],['blnk',19],['blnk',19], ['i',19],['n',19],['v',19],['a',19],['d',19],['e',19],['r',19],['s',19],['equa',21],['ques',21],['blnk',21],['m',21],['y',21],['s',21],['t',21],['e',21],['r',21],['y',21],['equa',22],[3,22],[0,22],['blnk',22],['p',22],['o',22],['i',22],['n',22],['t',22],['s',22],['equa',23],[2,23],[0,23],['blnk',23],['p',23],['o',23],['i',23],['n',23],['t',23],['s',23],['equa',24],[1,24],[0,24],['blnk',24],['p',24],['o',24],['i',24],['n',24],['t',24],['s',24]];function ast() {txt('star',20);txt('s',20);txt('c',20);txt('o',20);txt('r',20);txt('e',20);txt('blnk',20);txt('a',20);txt('d',20);txt('v',20);txt('a',20);txt('n',20);txt('c',20);txt('e',20);txt('blnk',20);txt('t',20);txt('a',20);txt('b',20);txt('l',20);txt('e',20);txt('star',20);generate(8,14,7,16,motherShip.a,'motherShip.a',gameColour,21);generate(9,13,8,8,alien.a[1],'alien.a[1]',gameColour,22);generate(9,13,8,11,alien.b[0],'alien.b[0]',gameColour,23);generate(9,13,8,12,alien.c[1],'alien.c[1]',gameColour,24);}//!function splashScreen() {counters.ctrl = 0;if (stopFlash){return false;}var pse = (counters.splash == 19)?1000:110;if (counters.splash == 20) {ast();}txt(splash[counters.splash][0],splash[counters.splash][1]);counters.splash++;if (counters.splash < splash.length) {setTimeout(runSplash,pse);}else {setTimeout(function() {introFlash.style.display = 'none';for (var i = 0; i < 7; i++) {d.getElementById('flsh'+i).innerHTML = '';}howToFlash.style.display = 'block';},3000);setTimeout(ctrlScreen,4000);}}//!function runSplash() {splashScreen();}//!function generate(ch,cw,sh,sw,type,n,col,dest) {var sendTo;var Adj = (dest < 5) ? 0 : pxs * 1.3;var build = '';var len = sh * sw;var c = 0;var x = 0;var y = -pxs;for (var i = 0; i < 4; i++) {if (dest == i) {sendTo = bnkrs[i];}}if (dest == 4) {sendTo = bulletExpContainer;}if (dest == 44) {sendTo = bulletExpContainerT;}if (dest == 5) {sendTo = topInfo;}if (dest == 6) {sendTo = scoreInfo;}if (dest == 7) {sendTo = score;}if (dest == 8) {sendTo = hiScore;}if (dest == 9) {sendTo = gameOverContainer;}if (dest == 10) {sendTo = cannonsInfo;}if (dest == 11) {sendTo = creditsInfo;}if (dest == 12) {sendTo = motherContainer;}for (var i = 0; i < 4; i++) {if (dest == 13+i) {sendTo = expl[i];}}if (dest == 18) {sendTo = inf0;}if (dest == 19) {sendTo = inf1;}if (dest == 20) {sendTo = inf2;}if (dest == 21) {sendTo = inf3;}if (dest == 22) {sendTo = inf4;}if (dest == 23) {sendTo = inf5;}if (dest == 24) {sendTo = inf6;}if (dest == 25) {sendTo = how0;}if (dest == 26) {sendTo = how1;}if (dest == 27) {sendTo = how2;}if (dest == 28) {sendTo = how3;}if (dest == 29) {sendTo = how4;}if (dest == 30) {sendTo = how5;}if (dest == 31) {sendTo = how6;}var oc1 = d.createElement('div');oc1.setAttribute('style', 'display: inline-block;'+'position: relative;'+'height: '+ ch * pxs +'px;'+'width: '+ cw * pxs +'px;'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;'+'margin: 0px '+Adj+'px 0px '+Adj+'px;');sendTo.appendChild(oc1);var ic1 = d.createElement('div');ic1.setAttribute('id', n);ic1.setAttribute('style', 'display: block;'+'position: absolute;'+'height: '+ sh * pxs +'px;'+'width: '+ sw * pxs +'px;'+'margin: auto;top: 0;left: 0;right: 0;bottom: 0;'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');oc1.appendChild(ic1);for (var i = 0; i < len; i++) {c++;x += pxs;if (i % sw == 0) {x = 0;y += pxs;}var pxls = '
';for (var j = 0; j < type.length; j++) {if (c == type[j]){build += pxls;} }}var svgImage = '
';ic1.innerHTML = svgImage;}//!function imgGen(ch,cw,sh,sw,type,n,col,dest) {var sendTo;var iD = '';if (typeof dest == 'number') {sendTo = d.getElementById('grd'+dest);iD = 'a'+dest;}if (dest == 'b') {sendTo = bulletContainer;}if (dest == 'c') {sendTo = cannonContainer;}if (dest == 'm') {sendTo = motherContainer;}if (dest == 'b1') {sendTo = aBomb;}if (dest == 'b2') {sendTo = bBomb;}if (dest == 'b3') {sendTo = cBomb;}var alg = (typeof dest != 'number')?'':'top:0';var build = '';var len = sh * sw;var c = 0;var x = 0;var y = -pxs;var oc2 = d.createElement('div');oc2.setAttribute('style', 'display:flex;'+'position: absolute;'+'justify-content: center;'+'align-items: center;'+'height: '+ ch * pxs +'px;'+'width: '+ cw * pxs +'px;'+'margin:0;padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');sendTo.appendChild(oc2);var ic2 = d.createElement('div');ic2.setAttribute('id', iD);ic2.setAttribute('style', 'display: block;'+'position: absolute;'+'height: '+ sh * pxs +'px;'+'width: '+ sw * pxs +'px;'+'margin: auto;left: 0;right: 0; bottom: 0;'+alg+';'+'padding: 0;font-size: 0;line-height: 0;'+'background-color: transparent;');oc2.appendChild(ic2);for (var i = 0; i < len; i++) {c++;x += pxs;if (i % sw == 0) {x = 0;y += pxs;}var pxls = '
';for (var j = 0; j < type.length; j++) {if (c == type[j]){build += pxls;} }}var genSvg = '
';var genImg = d.createElement('img');genImg.setAttribute('src', 'data:image/svg+xml,' + encode(genSvg) );genImg.setAttribute('id', n);genImg.setAttribute('style', 'display:none');ic2.appendChild(genImg);}//End.function populate() {for (var i = 0; i < 11; i++) {imgGen(9,13,8,8,alien.a[0],'alien.a[0]',gameColour,i);imgGen(9,13,8,8,alien.a[1],'alien.a[1]',gameColour,i);imgGen(9,13,9,13,alien.hit,'alien.hit',gameColour,i);}for (var i = 11; i < 33; i++) {imgGen(9,13,8,11,alien.b[0],'alien.b[0]',gameColour,i);imgGen(9,13,8,11,alien.b[1],'alien.b[1]',gameColour,i);imgGen(9,13,9,13,alien.hit,'alien.hit',gameColour,i);}for (var i = 33; i < 55; i++) {imgGen(9,13,8,12,alien.c[0],'alien.c[0]',gameColour,i);imgGen(9,13,8,12,alien.c[1],'alien.c[1]',gameColour,i);imgGen(9,13,9,13,alien.hit,'alien.hit',gameColour,i);}for (var i = 0; i < 4; i++) {generate(16,21,16,21,bunker,'bunker','#00dd00',i);imgGen(8,3,8,3,bomb.a[i],'bomb.a[i]',gameColour,'b1');imgGen(8,3,8,3,bomb.b[i],'bomb.b[i]',gameColour,'b2');imgGen(8,3,8,3,bomb.c[i],'bomb.c[i]',gameColour,'b3');}for (var i = 0; i < expl.length; i++) {generate(8,6,8,6,bombHit,'bombHit',gameColour,13+i);}imgGen(8,1,8,1,bullet,'bullet',gameColour,'b');imgGen(9,16,8,13,cannon.a,'cannon.a','#00dd00','c');imgGen(9,16,9,16,cannon.b,'cannon.b','#00dd00','c');imgGen(9,16,8,14,cannon.c,'cannon.c','#00dd00','c');generate(8,8,8,8,bulletExp,'bulletExp',gameColour,4);generate(8,8,8,8,bulletExp,'bulletExpT',motherShipColour,44);}//!populate();function readyStart() {coin(0,0);clearSplash();var swtch = (counters.ready % 2 == 1)?'block':'none';counters.ready++;score.style.display = swtch;if (counters.ready < 24) {setTimeout(flash,80);}else {setTimeout(initState,500);}}//!function flash() {readyStart(); }//!function initVis() {var el = d.getElementById('grd'+marchOrder[counters.init]);if (el) {el.style.visibility = 'visible';}counters.init++;if (counters.init < marchOrder.length) {setTimeout(stepVis,1000/60);}if (counters.init == marchOrder.length) {alienMarch();if (apiCapable) {beat();}}}//!function stepVis() {initVis();}//!function initState() {clearSplash();for (var i = 0; i < 55; i++) {var el = d.getElementById('grd'+i);var a = el.getElementsByTagName('img')[0];var b = el.getElementsByTagName('img')[1];var c = el.getElementsByTagName('img')[2];a.style.display = 'none';b.style.display = 'block';}for (var i = 0; i < 4; i++) {bnkrs[i].style.display = 'block';}bulletContainer.getElementsByTagName('img')[0].style.display = 'block';bulletContainer.style.display = 'none';var ca = cannonContainer;var aa = ca.getElementsByTagName('img')[0];var bb = ca.getElementsByTagName('img')[1];var cc = ca.getElementsByTagName('img')[2];setTimeout(function(){aa.style.display = 'block';initcontrols = true;},2500);bb.style.display = 'none';cc.style.display = 'none';initVis();msDsp();}//!/* Player cannons left & credit counts */function Cannons(n) {if (atZeroAlt) {return false;}cannonsInfo.innerHTML = '';txt(n,10);txt('blnk',10);if (n > 0) {if (n >= 7) {n = 7;}for (var i = 0; i < n-1; i++) {generate(8,13,8,13,cannon.a,'cannon.a','#00dd00',10);}}}//!Cannons(cannonCount);function coin(a,b) {var c = ['c','r','e','d','i','t','blnk'];creditsInfo.innerHTML = '';for (var i = 0; i < c.length; i++) {txt(c[i],11);}txt(a,11);txt(b,11);}coin(0,1);/* Lazer cannon hits */function bang() {if (cannonHit) {return false;}clearTimeout(timers.beat);stopUser();cannonHit = true;if (cannonCount > 0) {if (apiCapable) {decode1(cnnnHt);} handleCannonHit();}}//!function handleCannonHit() {counters.cannon++;var ca = cannonContainer;var aa = ca.getElementsByTagName('img')[0];var bb = ca.getElementsByTagName('img')[1];var cc = ca.getElementsByTagName('img')[2];aa.style.display = 'none';if (bb.style.display == 'block') {bb.style.display = 'none';cc.style.display = 'block';}else {bb.style.display = 'block';cc.style.display = 'none';}setTimeout(function() { aniCannon(ca,aa,bb,cc); },80);}//End!function aniCannon(x,a,b,c) {if (counters.cannon < 16) {handleCannonHit();}else {fired = true;b.style.display = 'none';c.style.display = 'none';counters.cannon = 0;cannonCount--;x.style.transform = 'translate3d(-200px, '+cannonProps.y+'px, 0)';setTimeout(function() {if (!gameOver) {fired = false;cannonProps.x = cannonProps.min;x.style.transform = 'translate3d('+cannonProps.min+'px, '+cannonProps.y+'px, 0)';}a.style.display = (cannonCount > 0 && !atZeroAlt)?'block':'none';cannonHit = false;if (cannonCount >= 0) {Cannons(cannonCount);}cannonContainer.style.transform = 'translate3d('+cannonProps.min+'px, '+cannonProps.y+'px, 0)';cannonCentre = bulletProps.x;allowUser();if (!atZeroAlt){doMarch();}if (!gameOver) {beat();}},2000);}}//End!/* Destroy bunkers via invaders marching through them */function Damage(el,n) {var len = bnkrs[n].getElementsByTagName('rect').length;var a = el.getBoundingClientRect();var x = a.left,y = a.top,w = a.width, h = (a.height - pxs);var tmp = bnkrs[n].getBoundingClientRect();var by = tmp.top;var bh = tmp.top + tmp.height;if (y + h < by || y > bh || bunkPix[n].length >= len) {return false;}for (var i = 0; i < len; i++) {var siloId = bnkrs[n].getElementsByTagName('rect')[i];var siloPixels = siloId.getBoundingClientRect();var sx = siloPixels.left;var sy = siloPixels.top;if (x <= sx && x+w >= sx && y+h >= sy) {siloId.style.display = 'none';bunkPix[n].push(siloId);}}}//!/* Destroy bunkers via lazer cannon */function playerDestroyBunker(len,bunkerPixelHit) {var b = bunkerPixelHit.getBoundingClientRect();var hx = b.left,hy = b.top;for (var i = len-1; i >= 0; --i) {var theseBunkerPixels = bnkrs[whichBunker].getElementsByTagName('rect')[i];var theseBunkerPixelCoords = theseBunkerPixels.getBoundingClientRect();var px = theseBunkerPixelCoords.left,py = theseBunkerPixelCoords.top;for (var j = ey.length-1; j >= 0; --j) {var epx = Math.ceil(hx + (ex[j] * pxs) * scl),epy = Math.ceil(hy + (ey[j] * pxs) * scl);if (epx == Math.ceil(px) && epy == Math.ceil(py)) {theseBunkerPixels.style.display = 'none';break;}}}setTimeout(function() {doBunkerDamage = false;bulletExpContainer.style.display = 'none';},100);}//!function shootInvaderBombs(thisBomb,thisBombStyle,bomb,bullet,bulletVel,explosion,ox,oy) {if (thisBomb.running && (bullet.top - bulletVel) <= (bomb.top + bomb.height + thisBomb.v) && bomb.top <= (bullet.top + bullet.height) && bullet.left >= (bomb.left - 1 * pxs) && bullet.left <= (bomb.left + bomb.width + 1 * pxs)) {thisBombStyle.style.display = 'none';explosion.style.display = 'block';explosion.style.transform = 'translate3d('+((bomb.left - (pxs * 3)) - ox)+'px, '+(bomb.top - oy)+'px, 0)';setTimeout(function() {explosion.style.display = 'none';thisBomb.running = false;},250);clearTimeout(thisBomb.tmr);thisBomb.counter = 0;fireReset();return false;}}/* Cannon shot, invader, mothership and ceiling hits */function fireReset() {bulletContainer.style.display = 'none';fired = false;bulletProps.y = pxs * 225;clearTimeout(timers.lazer);}//!function shoot() {if (gameOver || marchOrder.length < 1 || cannonHit) {fireReset();return false;}var os = innerContainer.getBoundingClientRect();var ox = os.left;var oy = os.top;if (!fired) {bulletPos = cannonCentre;}fired = true;bulletContainer.style.display = 'block';bulletProps.y -= bulletProps.v;var b = bulletContainer.getBoundingClientRect();//Must be here to read moving bullet!var ab = aBomb.getBoundingClientRect();var bb = bBomb.getBoundingClientRect();var cb = cBomb.getBoundingClientRect();timers.lazer = setTimeout(shoot,bulletProps.t); /* Bullet hitting bombs */if (bulletProps.y < pxs * 204) {shootInvaderBombs(aBombProps,aBomb,ab,b,bulletProps.v,expl[0],ox,oy);shootInvaderBombs(bBombProps,bBomb,bb,b,bulletProps.v,expl[1],ox,oy);shootInvaderBombs(cBombProps,cBomb,cb,b,bulletProps.v,expl[2],ox,oy);}/* Prepare for bunker damage from cannon. Which bunker is being hit */for (var i = 0; i < 4; i++) {var s = bnkrs[i].getBoundingClientRect();if (b.top - bulletProps.v <= s.top + s.height && b.top + bulletProps.v >= s.top && b.left >= s.left && b.left <= s.left + s.width) {whichBunker = i;doBunkerDamage = true;break;}else {doBunkerDamage = false;//?}}if (doBunkerDamage) {var len = bnkrs[whichBunker].getElementsByTagName('rect').length;for (var i = len-1; i >= 0; --i) {var siloId = bnkrs[whichBunker].getElementsByTagName('rect')[i];var siloPixels = siloId.getBoundingClientRect();var sx = siloPixels.left - ox;var sy = siloPixels.top - oy;if (b.top - bulletProps.v <= siloPixels.top && b.left + (b.width/2) >= siloPixels.left && b.left <= siloPixels.left + siloPixels.width) {bulletExpContainer.style.display = 'block'; bulletExpContainer.style.transform = 'translate3d('+(sx - (pxs * 4))+'px, '+(sy - (pxs * 2))+'px, 0)';setTimeout(playerDestroyBunker(len,siloId),100);fireReset();break;}}}/* Alien hits */var i = 55;while (i--) {var a = d.getElementById('a'+i).getBoundingClientRect();if (b.top - bulletProps.v <= a.top + a.height && b.top >= a.top && ((b.left + b.width) - march) >= a.left && b.left <= a.left + a.width) {bulletContainer.style.display = 'none';bulletProps.y = pxs * 225;//Bare minimum!clearTimeout(timers.lazer);handleAlienHit(i);break;}}/* Mother ship hits */if (d.getElementById('motherShip.a')) {var m = d.getElementById('motherShip.a').getBoundingClientRect();if (b.top <= m.top + m.height && b.left >= m.left && b.left <= m.left + m.width) {fireReset();handleMotherHit();}}/* Hit nothing - ceiling hits */if (bulletProps.y < ceiling) {fireReset();//d.getElementById('gbulletExp').style.fill = '#ff4a26';bulletExpContainerT.style.transform = 'translate3d('+(bulletPos - 4 * pxs)+'px, '+(pxs * 26)+'px, 0)';bulletExpContainerT.style.display = 'block';setTimeout(function() {bulletExpContainerT.style.display = 'none';},250);}bulletContainer.style.transform = 'translate3d('+bulletPos+'px, '+bulletProps.y+'px, 0)';}//!/* All invader bomb control */function assignBombs() {if (marchOrder.length < 1 || gameOver || atZeroAlt) {return false;}var inc = Math.floor(counters.hit/10);//108var rnd = Math.floor(Math.random() * (168 - inc));if (!aBombProps.running && rnd < 2) {animateBombs(aBomb,aBombProps,0);}if (!bBombProps.running && rnd > 2 && rnd < 5) {animateBombs(bBomb,bBombProps,1);}if (!cBombProps.running && rnd == 10) {animateBombs(cBomb,cBombProps,2);}}//!function bombDestroyBunker(len,bunkerPixelHit,n,c) {var tx,ty;if (n == 1) {tx = bex;ty = bey;}else {tx = atx;ty = aty;}var b = bunkerPixelHit.getBoundingClientRect();var bx = b.left,by = b.top;for (var i = 0; i < len; i++) {var theseBunkerPixels = bnkrs[thisBunker].getElementsByTagName('rect')[i];var theseBunkerPixelCoords = theseBunkerPixels.getBoundingClientRect();var px = theseBunkerPixelCoords.left,py = theseBunkerPixelCoords.top;for (var j = 0; j < bey.length; j++) {var epx = Math.ceil(bx + (tx[j] * pxs) * scl),epy = Math.ceil(by + (ty[j] * pxs) * scl);if (epx == Math.ceil(px) && epy == Math.ceil(py)) {theseBunkerPixels.style.display = 'none';break;}}}}//!function theBombs(el,c,n,l) {var os = innerContainer.getBoundingClientRect();var ox = os.left;var oy = os.top;var thisBomb = el;var immune = ((l.top + l.height) - oy >= cannonProps.y);/*In the original game, the cannon is immune from bombs dropped by invaders with onedrop step to go before reaching floor. This allows you to scoot underneath unharmed.*/function ani() {var tmp = thisBomb.getElementsByTagName('img');c.y += c.v;for (var i = 0; i < 4; i++) {if (i == c.counter) {tmp[i].style.display = 'block';}else {tmp[i].style.display = 'none';}}c.counter++;if (c.counter > 3) {c.counter = 0;}for (var i = 0; i < 4; i++) {var s = bnkrs[i].getBoundingClientRect();if ((c.y + aBombProps.h + aBombProps.v) >= (s.top - oy) && c.y <= (s.top + s.height - oy) && (c.x + aBombProps.w) >= (s.left - ox) && c.x <= (s.left - ox) + s.width) {c.bunkerHit = true;thisBunker = i;break;}}var cannonDead = (!immune && !cannonHit && c.x <= (cannonProps.x + (16 * pxs)) && (c.x + aBombProps.w) > cannonProps.x && (c.y + aBombProps.h) >= cannonProps.y && c.y <= cannonProps.y + (9 * pxs));if (c.y > pxs * 236) {c.y = pxs * 236;c.floorHit = true;}thisBomb.style.transform = 'translate3d('+(c.x)+'px, '+(c.y)+'px, 0)';c.tmr = setTimeout(ani,c.t);if (c.bunkerHit) {var len = bnkrs[thisBunker].getElementsByTagName('rect').length;for (var i = 0; i < len; i++) {var siloId = bnkrs[thisBunker].getElementsByTagName('rect')[i];var siloPixels = siloId.getBoundingClientRect();var sx = siloPixels.left - ox;var sy = siloPixels.top - oy;if ((c.y + aBombProps.h) >= sy && (c.x + aBombProps.w) >= sx && c.x <= sx + siloPixels.width) {el.style.display = 'none';expl[n].style.transform = 'translate3d('+(c.x - (pxs * 2.5))+'px, '+(sy - c.exY)+'px, 0)';expl[n].style.display = 'block';setTimeout(function() {expl[n].style.display = 'none';c.running = false;},250);clearTimeout(c.tmr);c.bunkerHit = false;c.counter = 0;setTimeout(bombDestroyBunker(len,siloId,n,c),250);// here!!break;return false;}}}if (cannonDead) {el.style.display = 'none';setTimeout(function() {c.running = false;},250);clearTimeout(c.tmr);bang();c.counter = 0;return false;}if (c.floorHit) {el.style.display = 'none';expl[n].style.display = 'block';expl[n].style.transform = 'translate3d('+(c.x - (pxs * 2.5))+'px, '+c.y+'px, 0)';setTimeout(function() {expl[n].style.display = 'none';c.running = false;},250);clearTimeout(c.tmr);c.floorHit = false;c.counter = 0;return false;}}//!ani();}//!function animateBombs(el,c,n) {if (c.running || marchOrder.length < 1 || gameOver || atZeroAlt) {return false;}c.running = true;var p = availableBombDropPos();el.style.display = 'block';c.exY = 6 * pxs;var a = p.inv;for (var i = 0; i < 4; i++) {var bun = bnkrs[i].getBoundingClientRect();if (a.top + a.height >= (bun.top) && a.top + a.height <= (bun.top + bun.height) && a.left + (a.width/2) > (bun.left) && a.left + (a.width/2) < (bun.left + bun.width)) {c.exY = 0;break;}}c.x = p.x;c.y = p.y;el.style.transform = 'translate3d('+(p.x)+'px, '+(p.y)+'px, 0)';theBombs(el,c,n,a);}//!/* Invaders allowed to drop bombs and their pos */function availableBombDropPos() {var ls = redDoubPos[redDoubPos.length-1];var rnd = Math.floor(Math.random() * lowestInvaders.length);redDoubPos.push(rnd);if (rnd == ls && rnd > 0){rnd--;redDoubPos = [];}var os = innerContainer.getBoundingClientRect();var el = d.getElementById(lowestInvaders[rnd]).getBoundingClientRect();var pos = {};pos.y = el.top - os.top,pos.x = el.left - os.left;var w = ((el.width/2) - (pxs * 1.5));var h = (8 * pxs);var p = {x: (pos.x + w) ,y: (pos.y + h), inv: el}return p;}//!function invadersAllowedToBomb(r) {lowestInvaders = [];var invader = 'grd'+r;for (var i = 0; i < InvaderColumns.length; i++) {InvaderColumns[i] = InvaderColumns[i].filter(function(item) {return item !== invader;});if (InvaderColumns[i].length > 0) {lowestInvaders.push(InvaderColumns[i][InvaderColumns[i].length - 1]);}}}//!/* Mothership control */function clearMotherShip() {forceEnd = true;clearTimeout(timers.shipRight);clearTimeout(timers.shipLeft);mthrShpRnnng = false;var m = shipProps;m.x = m.b;motherShipHit = false;resetMother();}function motherShipControl() {var m = shipProps;if (m.x >= m.b) {motherShipGoLeft();}else if (m.x <= m.a) {motherShipGoRight();}}//!function motherShipGoLeft() {var m = shipProps;if (motherShipHit) {m.x = m.a;motherShipHit = false;return false;}if (!motherShipHit) {m.x -= m.v;if (m.x <= m.a) {mthrShpRnnng = false;m.x = m.a;motherContainer.innerHTML = '';return false;}}motherContainer.style.transform = 'translate3d('+m.x+'px, '+m.y+'px, 0)';timers.shipLeft = setTimeout(motherShipGoLeft,m.t);}//!function motherShipGoRight() {var m = shipProps;if (motherShipHit) {m.x = m.b;motherShipHit = false;return false;}if (!motherShipHit) {m.x += m.v;if (m.x >= m.b) {mthrShpRnnng = false;m.x = m.b;motherContainer.innerHTML = '';return false;}}motherContainer.style.transform = 'translate3d('+m.x+'px, '+m.y+'px, 0)';timers.shipRight = setTimeout(motherShipGoRight,m.t);}//!function showMother() {generate(8,21,7,16,motherShip.a,'motherShip.a',motherShipColour,12);if (apiCapable) {decode2(mthrshpAttck);}mthrShpRnnng = true;motherShipControl();}//!function resetMother() {motherContainer.innerHTML = '';if (!forceEnd) {mystery();}setTimeout(function() {motherContainer.innerHTML = '';},1000);}//!function handleMotherHit() {motherShipHit = true;motherContainer.innerHTML = '';generate(8,21,8,21,motherShip.b,'motherShip.b',motherShipColour,12);if (apiCapable) {decode1(mthrshpHt);}mthrShpRnnng = false;setTimeout(function() {resetMother();},700);}//!/* Invader hits */function handleAlienHit(r) {if (hit) {return false;}counters.hit += masterTimer;var val;if (apiCapable) {decode1(InvdrHit);}hit = true;var el = d.getElementById('grd'+r);var a = el.getElementsByTagName('img')[0];var b = el.getElementsByTagName('img')[1];var c = el.getElementsByTagName('img')[2];a.style.display = 'none';b.style.display = 'none';c.style.display = 'block';var tmp = a.id.replace(/[^a-z]/gi, "");if (tmp == "alienc") {val = 10;}else if (tmp == "alienb") {val = 20;}else {val = 30;}masterScore += parseInt(val);if (masterScore >= 10000) {masterScore -= 10000;}extraCannonScore += parseInt(val);scoreBoard(masterScore,7);if (!isIELocal) {if (localStorage.score < masterScore) {localStorage.score = masterScore;}}ind = marchOrder.indexOf(r);if (counters.march > ind) {counters.march--;}marchOrder = marchOrder.filter(function(item) {return item !== r;});invadersAllowedToBomb(r);setTimeout(function(){completeDeath(r);},hitDelayTimer);}//!function completeDeath(r) {d.getElementById('grd'+r).style.display = 'none';fired = false;hit = false;if (marchOrder.length > 0) {if (dropInProgress) {if (counters.drop > ind) {counters.drop--;} alienDrop();}}if (marchOrder.length > 0) {doMarch();}else {clearTimeout(timers.dsply);clearTimeout(timers.beat);timers.beat = null;counters.hit = 0;cannonProps.x = cannonProps.min;cannonContainer.style.transform = 'translate3d(-200px, '+cannonProps.y+'px, 0)';cannonContainer.style.display = 'none';bulletPos = cannonCentre;clearMotherShip();stopUser();setTimeout(newWave,1500);}}//!/* Invader march direction and drop */function alienDrop() {dropInProgress = true;if (hit) {return false;}if (counters.drop == marchOrder.length) {counters.drop = 0; dropInProgress = false; step = true;return false;}else {var el = d.getElementById('grd'+marchOrder[counters.drop]);ypos = parseFloat(el.style.top);ypos += dropStep; if (ypos >= zeroAlt) {atZeroAlt = true; fired = true;gameOver = true;}el.style.top = ypos + 'px';counters.drop++; for (var i = 0; i < 4; i++) {Damage(el,i);}setTimeout(doDrop,1000/60);}}function doDrop() {alienDrop();}//!/* Init mothership */function msDsp() {if (marchOrder.length < 1) {return false;}counters.ship++;if (counters.ship >= 5) {showMother();counters.ship = 0;}timers.dsply = setTimeout(msDsp,5000);}/* Init invader march */function alienMarch() {if (cannonHit) {cannonCentre = bulletProps.x;}if (cannonCount < 1) {Cannons(0);gameOver = true;}if (gameOver || atZeroAlt) {var dela = (atZeroAlt)?3000:1000;var delb = (atZeroAlt)?6000:4000;var delc = (atZeroAlt)?7000:5000;bang();stopUser();clearMotherShip();clearTimeout(timers.dsply);clearTimeout(timers.beat);setTimeout(function() {type('game over',9);},dela);setTimeout(function() {gameOverContainer.innerHTML = '';invaderContainer.innerHTML = '';stopFlash = false;introFlash.style.display = 'block';for (var i = 0; i < 4; i++) {bnkrs[i].innerHTML = '';}},delb);setTimeout(splashScreen,delc);return false;}variTimer = (hit)? hitDelayTimer : masterTimer;if (counters.march >= marchOrder.length) {counters.march = 0;}var el = d.getElementById('grd'+marchOrder[counters.march]);var a = el.getElementsByTagName('img')[0];var b = el.getElementsByTagName('img')[1];var c = el.getElementsByTagName('img')[2];var lastAlien = 'grd'+marchOrder[marchOrder.length - 1];xpos = parseFloat(el.style.left);inPlay = (c.style.display != 'block');if (inPlay) {//Only animate the living.if (a.style.display == 'block') {a.style.display = 'none';b.style.display = 'block';}else {a.style.display = 'block';b.style.display = 'none';}if (dir == 0) {xpos += march;}else if (dir == 1) {xpos -= march;}}if ((dir == 0 && xpos >= boundry.right) || (dir == 1 && xpos <= boundry.left)) {step = false;}if (!step && el.id == lastAlien) {if (!dropInProgress) {alienDrop();dir = (dir == 0)?1:0;}} counters.march++;el.style.left = xpos + 'px';if (!hit) {for (var i = 0; i < 4; i++) {Damage(el,i);}setTimeout(doMarch,variTimer);}}//!function doMarch() {if (cannonHit) {return false;}if (marchOrder.length > 0) {alienMarch();assignBombs();}}//!/* Reset for new level */function newWave() {for (var i = 0; i < 4; i++) {bnkrs[i].innerHTML = '';bunkPix[i] = [];}for (var i = 0; i < expl.length; i++) {expl[i].innerHTML = '';}setTimeout(function() {cannonContainer.style.transform = 'translate3d('+cannonProps.min+'px, '+cannonProps.y+'px, 0)';cannonContainer.style.display = 'block';allowUser();},2500);cannonCentre = bulletProps.x;counters.hit = 0;initOrder();lowestInvaders = [];InvaderColumns = [];invaderContainer.innerHTML = '';bulletExpContainer.innerHTML = '';bulletExpContainerT.innerHTML = '';counters.init = 0;counters.wave++;if (counters.wave > 7) {counters.wave = 0;}tx = xInit;ty = (pxs * 40) + (dropStep * counters.wave);counters.drop = 0;counters.march = 0;atZeroAlt = false;forceEnd = false;cntr = 0dir = 0;step = true;xpos = 0;ypos = 0;ind = 0;dropInProgress = false;inPlay = true;initLayout();populate();initState();}//!window.addEventListener("load", function(){window.focus();setTimeout(splashScreen,1000);},false);