STORY LOOP FURRY PORN GAMES C SERVICES [?] [R] RND POPULAR | Archived flashes: 229595 |
/disc/ · /res/ — /show/ · /fap/ · /gg/ · /swf/ | P0001 · P2595 · P5190 |
A Very Merry Christmas! |
This is the info page for Flash #66779 |
Combined Code// unknown tag 88 length 68 movieClip 17 fps { frame 1 { fps = 30; var timeinit = new Date(); var lasttime = timeinit.getMilliseconds(); onEnterFrame = function () { var v1 = new Date(); timepassed = v1.getMilliseconds() - lasttime >= 0 ? v1.getMilliseconds() - lasttime : 1000 + (v1.getMilliseconds() - lasttime); fps = Math.round(10000 / timepassed) / 10; lasttime = v1.getMilliseconds(); }; } } frame 1 { function __com_mochibot__(swfid, mc, lv, trk) { var x; var g; var s; var fv; var sb; var u; var res; var mb; var mbc; var pv; mb = '__mochibot__'; mbc = 'mochibot.com'; g = _global ? _global : _level0._root; if (g[mb + swfid]) { return g[mb + swfid]; } s = System.security; x = mc._root.getSWFVersion; fv = x ? mc.getSWFVersion() : (_global ? 6 : 5); if (!s) { s = {}; } sb = s.sandboxType; if (sb == 'localWithFile') { return null; } x = s.allowDomain; if (x) { s.allowDomain(mbc); } x = s.allowInsecureDomain; if (x) { s.allowInsecureDomain(mbc); } pv = (fv == 5) ? /:$version : System.capabilities.version; u = 'http://' + mbc + '/my/core.swf?mv=8&fv=' + fv + '&v=' + escape(pv) + '&swfid=' + escape(swfid) + '&l=' + lv + '&f=' + mc + (sb ? '&sb=' + sb : '') + (trk ? '&t=1' : ''); lv = fv > 6 ? mc.getNextHighestDepth() : (g[mb + 'level'] ? g[mb + 'level'] + 1 : lv); g[mb + 'level'] = lv; if (fv == 5) { res = '_level' + lv; if (!eval(res)) { loadMovieNum(u, lv); } return res; } res = mc.createEmptyMovieClip(mb + swfid, lv); res.loadMovie(u); return res; } __com_mochibot__('d5b89272', this, 10301, true); } frame 1 { _root.selectedturretframe = 0; stop(); } // unknown tag 88 length 60 movieClip 22 { } instance of movieClip 22 { onClipEvent (enterFrame) { var bytes = _root.getBytesTotal(); var bytes_loaded = _root.getBytesLoaded(); _root.percent = int((bytes_loaded / bytes) * 100) + '%'; if (bytes_loaded == bytes) { _root.play(); } } } frame 2 { function save(n) { savefile.data['profile' + n + 'name'] = _root['profile' + n + 'name']; if (_root['profile' + _root.profilenumber + 'totalscore'] >= 50000) { if (!_root['profile' + _root.profilenumber + 'achievement18']) { _root['profile' + _root.profilenumber + 'achievement18'] = true; _root.achievement.gotoAndStop(18); _root.achievement.timer = 30; } } if (_root['profile' + _root.profilenumber + 'totalscore'] >= 200000) { if (!_root['profile' + _root.profilenumber + 'achievement19']) { _root['profile' + _root.profilenumber + 'achievement19'] = true; _root.achievement.gotoAndStop(19); _root.achievement.timer = 30; } } if (_root['profile' + _root.profilenumber + 'totalscore'] >= 500000) { if (!_root['profile' + _root.profilenumber + 'achievement20']) { _root['profile' + _root.profilenumber + 'achievement20'] = true; _root.achievement.gotoAndStop(20); _root.achievement.timer = 30; } } if (_root['profile' + _root.profilenumber + 'enemiesdestroyed'] >= 100) { if (!_root['profile' + _root.profilenumber + 'achievement27']) { _root['profile' + _root.profilenumber + 'achievement27'] = true; _root.achievement.gotoAndStop(27); _root.achievement.timer = 30; } } if (_root['profile' + _root.profilenumber + 'enemiesdestroyed'] >= 200) { if (!_root['profile' + _root.profilenumber + 'achievement28']) { _root['profile' + _root.profilenumber + 'achievement28'] = true; _root.achievement.gotoAndStop(27); _root.achievement.timer = 30; } } c = 1; while (c < 29) { savefile.data['profile' + n + 'achievement' + c] = _root['profile' + n + 'achievement' + c]; ++c; } d = 1; while (d < 7) { savefile.data['profile' + n + 'level' + d + 'completed'] = _root['profile' + n + 'level' + d + 'completed']; ++d; } savefile.data['profile' + n + 'enemiesdestroyed'] = _root['profile' + n + 'enemiesdestroyed']; savefile.data['profile' + n + 'totalscore'] = _root['profile' + n + 'totalscore']; savefile.flush(); } var savefile = SharedObject.getLocal('AirAssualt'); i = 1; while (i < 4) { _root['profile' + i + 'name'] = savefile.data['profile' + i + 'name']; _root['profile' + i + 'enemiesdestroyed'] = savefile.data['profile' + i + 'enemiesdestroyed']; _root['profile' + i + 'totalscore'] = savefile.data['profile' + i + 'totalscore']; if (savefile.data['profile' + i + 'name'] == undefined) { _root['profile' + i + 'enemiesdestroyed'] = 0; _root['profile' + i + 'totalscore'] = 0; _root['profile' + i + 'name'] = 'Empty'; } c = 1; while (c < 29) { _root['profile' + i + 'achievement' + c] = savefile.data['profile' + i + 'achievement' + c]; if (savefile.data['profile' + i + 'achievement' + c] == undefined) { _root['profile' + i + 'achievement' + c] = false; } ++c; } d = 1; while (d < 7) { _root['profile' + i + 'level' + d + 'completed'] = savefile.data['profile' + i + 'level' + d + 'completed']; if (savefile.data['profile' + i + 'level' + d + 'completed'] == undefined) { _root['profile' + i + 'level' + d + 'completed'] = false; } ++d; } ++i; } } frame 3 { stop(); } button 28 { on (press) { i = 1; _root['profile' + i + 'name'] = 'Empty'; _root['profile' + i + 'enemiesdestroyed'] = 0; _root['profile' + i + 'totalscore'] = 0; _root['profile' + i + 'level0completed'] = true; savefile.data['profile' + i + 'name'] = 'Empty'; savefile.data['profile' + i + 'enemiesdestroyed'] = 0; savefile.data['profile' + i + 'totalscore'] = 0; c = 1; while (c < 29) { _root['profile' + i + 'achievement' + c] = false; savefile.data['profile' + i + 'achievement' + c] = false; ++c; } d = 1; while (d < 7) { _root['profile' + i + 'level' + d + 'completed'] = false; savefile.data['profile' + i + 'level' + d + 'completed'] = false; ++d; } } } button 30 { on (press) { _root.ename.number = 1; _root.entername = true; _root.NEWPROFILE = false; } } button 31 { on (press) { i = 2; _root['profile' + i + 'name'] = 'Empty'; _root['profile' + i + 'enemiesdestroyed'] = 0; _root['profile' + i + 'totalscore'] = 0; savefile.data['profile' + i + 'name'] = 'Empty'; savefile.data['profile' + i + 'enemiesdestroyed'] = 0; savefile.data['profile' + i + 'totalscore'] = 0; c = 1; while (c < 29) { _root['profile' + i + 'achievement' + c] = false; savefile.data['profile' + i + 'achievement' + c] = false; ++c; } d = 1; while (d < 7) { _root['profile' + i + 'level' + d + 'completed'] = false; savefile.data['profile' + i + 'level' + d + 'completed'] = false; ++d; } } } button 32 { on (press) { _root.ename.number = 2; _root.entername = true; _root.NEWPROFILE = false; } } button 33 { on (press) { i = 3; _root['profile' + i + 'name'] = 'Empty'; _root['profile' + i + 'enemiesdestroyed'] = 0; _root['profile' + i + 'totalscore'] = 0; savefile.data['profile' + i + 'name'] = 'Empty'; savefile.data['profile' + i + 'enemiesdestroyed'] = 0; savefile.data['profile' + i + 'totalscore'] = 0; c = 1; while (c < 29) { _root['profile' + i + 'achievement' + c] = false; savefile.data['profile' + i + 'achievement' + c] = false; ++c; } d = 1; while (d < 7) { _root['profile' + i + 'level' + d + 'completed'] = false; savefile.data['profile' + i + 'level' + d + 'completed'] = false; ++d; } } } button 34 { on (press) { _root.ename.number = 3; _root.entername = true; _root.NEWPROFILE = false; } } button 39 { on (press) { _root.profilenumber = 3; if (_root.profile3name == 'Empty') { _root.entername = true; _root.ename.number = 3; _root.NEWPROFILE = true; } else { play(); } } } button 40 { on (press) { _root.profilenumber = 2; if (_root.profile2name == 'Empty') { _root.entername = true; _root.ename.number = 2; _root.NEWPROFILE = true; } else { play(); } } } button 41 { on (press) { _root.profilenumber = 1; if (_root.profile1name == 'Empty') { _root.entername = true; _root.ename.number = 1; _root.NEWPROFILE = true; } else { play(); } } } button 46 { on (press) { _root['profile' + number + 'name'] = _root.tempname; if (_root.NEWPROFILE) { _root.play(); } else { _root.entername = false; } } } button 47 { on (press) { _root.entername = false; } } movieClip 49 { } movieClip 50 { instance of movieClip 49 { onClipEvent (load) { mousecount = 0; } onClipEvent (enterFrame) { if (_parent._visible) { if (!done) { if (Key.isDown(1)) { if (!mousedown) { mousedown = true; if (mousecount >= 1) { if (_root.tempname == 'Enter Name') { if (_root._xmouse < _x + _width / 2 + _parent._x && _root._xmouse > _x - _width / 2 + _parent._x) { if (_root._ymouse > _y + 20 + _parent._y && _root._ymouse < _y + 200 + _parent._y) { _root.tempname = ''; done = true; } } } } else { ++mousecount; } } } else { mousedown = false; } } } } } } instance ename of movieClip 50 { onClipEvent (load) { if (_root.entername) { _visible = false; } else { _visible = false; } } onClipEvent (enterFrame) { if (_root.entername) { _visible = true; } else { _root.tempname = 'Enter Name'; _visible = false; } } } frame 4 { stop(); _root['profile' + _root.profilenumber + 'level0completed'] = true; turret1spd = 90; turret2spd = 45; turret3spd = 30; turret4spd = 300; turret5spd = 300; turret1damage = 2; turret2damage = 0; turret3damage = 2; turret4damage = 25; turret5damage = 300; turret1cost = 100; turret2cost = 300; turret3cost = 400; turret4cost = 600; turret5cost = 1000; turret6cost = 1000; enemy1speed = 1; enemy2speed = 1; enemy3speed = 1; enemy4speed = 1; enemy5speed = 1; enemy1hp = 5; enemy2hp = 1; enemy3hp = 40; enemy4hp = 25; enemy5hp = 30; i = 1; while (i < 6) { _root['enemy' + i + 'worth'] = _root['enemy' + i + 'speed'] * _root['enemy' + i + 'hp'] * 4; ++i; } _root.level0completed = true; save(_root.profilenumber); } button 51 { on (press) { _root.getURL('http://caiwengi.newgrounds.com/', _blank); } } button 54 { on (press) { _root.play(); } } button 55 { on (press) { _root.getURL('http://caiwengi.newgrounds.com'); } } button 56 { on (press) { _root.achievements = true; _root.play(); } } movieClip 58 { } movieClip 60 { frame 1 { stop(); } } instance of movieClip 60 { onClipEvent (press) { _root.s2._visible = true; } } // unknown tag 88 length 62 movieClip 65 { frame 1 { stop(); } } instance of movieClip 65 { onClipEvent (release) { _root.q2._visible = true; } } button 67 { on (release) { _visible = false; _quality = 'LOW'; } } button 68 { on (release) { _visible = false; _quality = 'MEDIUM'; } } button 69 { on (release) { _visible = false; _quality = 'HIGH'; } } movieClip 70 { } instance q2 of movieClip 70 { onClipEvent (load) { _visible = false; } } movieClip 74 { frame 1 { explosionSound = new Sound(this); explosionSound.attachSound('idk'); explosionSound.start(); stop(); } frame 2 { explosionSound.stop(); } frame 3 { gotoAndStop(1); } } movieClip 77 { frame 1 { _root.SOUNDS = true; stop(); } frame 2 { _root.SOUNDS = false; } frame 3 { gotoAndStop(1); } } movieClip 78 { instance of movieClip 74 { onClipEvent (press) { nextFrame(); _parent._visible = false; } } instance of movieClip 77 { onClipEvent (press) { nextFrame(); _parent._visible = false; } } } instance s2 of movieClip 78 { onClipEvent (load) { _visible = false; } } movieClip 109 { frame 1 { stop(); } } instance achievement of movieClip 109 { onClipEvent (load) { _visible = false; timer = 0; } onClipEvent (enterFrame) { if (timer > 0) { _visible = true; this.swapDepths(2002); --timer; } else { if (_currentframe == 7) { _root['profile' + _root.profilenumber + 'achievement8'] = true; _root.achievement.gotoAndStop(8); _root.achievement.timer = 30; } if (_currentframe == 21 || _currentframe == 22 || _currentframe == 23 || _currentframe == 24 || _currentframe == 25) { if (_root['profile' + _root.profilenumber + 'achievement21'] && _root['profile' + _root.profilenumber + 'achievement22'] && _root['profile' + _root.profilenumber + 'achievement23'] && _root['profile' + _root.profilenumber + 'achievement24'] && _root['profile' + _root.profilenumber + 'achievement25']) { _root['profile' + _root.profilenumber + 'achievement26'] = true; _root.achievement.gotoAndStop(26); _root.achievement.timer = 30; } } _visible = false; } } } movieClip 111 { } button 112 { on (press) { _root.nextFrame(); } } frame 18 { if (_root.achievements) { gotoAndPlay('achievements'); } } button 116 { on (press) { _root.targetframe = 'campaign'; play(); } } button 117 { on (press) { _root.targetframe = 'survival'; play(); } } // unknown tag 88 length 86 button 121 { on (press) { _root.gotoAndStop(4); } } frame 32 { stop(); } frame 46 { gotoAndPlay(_root.targetframe); } frame 47 { _root.achievements = false; } frame 47 { scroll = 0; } movieClip 123 { } movieClip 125 { } movieClip 127 { } movieClip 133 { frame 1 { stop(); } } movieClip 188 { instance toparrow of movieClip 127 { onClipEvent (enterFrame) { spd = 5; if (Key.isDown(1)) { if (this.hitTest(_root._xmouse, _root._ymouse, true)) { if (_root.scroll > 0) { --_root.scroll; _parent._y += spd; _parent.bg._y -= spd; _parent.toparrow._y -= spd; _parent.bottomarrow._y -= spd; _parent.beam._y -= spd; } } } } } instance bottomarrow of movieClip 127 { onClipEvent (enterFrame) { spd = -5; if (Key.isDown(1)) { if (this.hitTest(_root._xmouse, _root._ymouse, true)) { if (_root.scroll < 200) { ++_root.scroll; _parent._y += spd; _parent.bg._y -= spd; _parent.toparrow._y -= spd; _parent.bottomarrow._y -= spd; _parent.beam._y -= spd; } } } } } instance of movieClip 133 { onClipEvent (load) { number = 1; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 2; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 3; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 4; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 5; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 6; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 7; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 8; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 9; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 10; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 11; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 12; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 13; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 14; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 15; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 16; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 17; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 18; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 19; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 20; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 21; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 22; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 23; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 24; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 25; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 26; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 27; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } instance of movieClip 133 { onClipEvent (load) { number = 28; if (_root['profile' + _root.profilenumber + 'achievement' + number] == true) { gotoAndStop(2); } } } } frame 60 { stop(); _root.achievementsdone = 0; c = 1; while (c < 29) { if (_root['profile' + _root.profilenumber + 'achievement' + c]) { ++_root.achievementsdone; } ++c; } _root.enemieskilled1 = _root['profile' + _root.profilenumber + 'enemiesdestroyed']; _root.totalscore1 = _root['profile' + _root.profilenumber + 'totalscore']; } // unknown tag 88 length 206 button 203 { on (press) { if (_root['profile' + _root.profilenumber + 'level0completed']) { _root.targetframe = 'level1'; play(); } } } button 204 { on (press) { if (_root['profile' + _root.profilenumber + 'level1completed']) { _root.targetframe = 'level2'; play(); } } } button 205 { on (press) { if (_root['profile' + _root.profilenumber + 'level2completed']) { _root.targetframe = 'level3'; play(); } } } button 206 { on (press) { if (_root['profile' + _root.profilenumber + 'level3completed']) { _root.targetframe = 'level4'; play(); } } } button 207 { on (press) { if (_root['profile' + _root.profilenumber + 'level4completed']) { _root.targetframe = 'level5'; play(); } } } button 208 { on (press) { if (_root['profile' + _root.profilenumber + 'level5completed']) { _root.targetframe = 'level6'; play(); } } } movieClip 212 { } instance of movieClip 212 { onClipEvent (load) { i = 1; trace(_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']); if (_root['profile' + _root.profilenumber + 'level' + i + 'completed'] == true) { gotoAndStop(1); } else { if (!_root['profile' + _root.profilenumber + 'level' + i + 'completed']) { if (_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']) { gotoAndStop(3); } else { gotoAndStop(2); } } } } } instance of movieClip 212 { onClipEvent (load) { i = 2; if (_root['profile' + _root.profilenumber + 'level' + i + 'completed'] == true) { gotoAndStop(1); } else { if (!_root['profile' + _root.profilenumber + 'level' + i + 'completed']) { if (_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']) { gotoAndStop(3); } else { gotoAndStop(2); } } } } } instance of movieClip 212 { onClipEvent (load) { i = 3; if (_root['profile' + _root.profilenumber + 'level' + i + 'completed'] == true) { gotoAndStop(1); } else { if (!_root['profile' + _root.profilenumber + 'level' + i + 'completed']) { if (_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']) { gotoAndStop(3); } else { gotoAndStop(2); } } } } } instance of movieClip 212 { onClipEvent (load) { i = 4; if (_root['profile' + _root.profilenumber + 'level' + i + 'completed'] == true) { gotoAndStop(1); } else { if (!_root['profile' + _root.profilenumber + 'level' + i + 'completed']) { if (_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']) { gotoAndStop(3); } else { gotoAndStop(2); } } } } } instance of movieClip 212 { onClipEvent (load) { i = 5; if (_root['profile' + _root.profilenumber + 'level' + i + 'completed'] == true) { gotoAndStop(1); } else { if (!_root['profile' + _root.profilenumber + 'level' + i + 'completed']) { if (_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']) { gotoAndStop(3); } else { gotoAndStop(2); } } } } } instance of movieClip 212 { onClipEvent (load) { i = 6; if (_root['profile' + _root.profilenumber + 'level' + i + 'completed'] == true) { gotoAndStop(1); } else { if (!_root['profile' + _root.profilenumber + 'level' + i + 'completed']) { if (_root['profile' + _root.profilenumber + 'level' + (i - 1) + 'completed']) { gotoAndStop(3); } else { gotoAndStop(2); } } } } } frame 78 { stop(); } frame 94 { _root.gotoAndPlay(_root.targetframe); } frame 95 { playermoney = 1000; liveslost = 0; distancegone = 0; sc = 0; smc = 0; ec = 0; tc = 0; timer = -1; dead = 0; build = true; enemiesdestroyed = 0; moneyearned = 0; } movieClip 214 { } movieClip 218 { frame 1 { stop(); } } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } movieClip 220 { } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } button 224 { on (press) { _root.build = true; _root.pause = true; } } button 227 { on (press) { if (_root.paused) { if (_root.build) { _root.build = false; } _root.paused = false; } else { _root.paused = true; } } } button 232 { on (press) { _root.sell = true; } } button 235 { on (press) { _root.sell = false; } } movieClip 236 { frame 1 { _name = 'pause1'; } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } movieClip 241 { } movieClip 242 { frame 1 { stop(); } } movieClip 246 { } movieClip 247 { } // unknown tag 88 length 48 movieClip 255 { } movieClip 256 { frame 1 { stop(); } frame 2 { gotoAndStop(1); if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('bullet1sound'); explosionSound.start(); } } instance gun of movieClip 247 { onClipEvent (load) { if (_root.Soundfx == 'off') { _parent.gotoAndStop(4); } } } instance of movieClip 255 { onClipEvent (load) { gotoAndStop(_parent.mode); } onClipEvent (enterFrame) { if (!_root.paused) { _parent.gotoAndStop(1); } } onClipEvent (press) { if (_parent.mode == 'manual') { _parent.mode = 'auto'; gotoAndStop(_parent.mode); } else { if (_parent.mode == 'auto') { _parent.mode = 'manual'; gotoAndStop(_parent.mode); } } } } } movieClip 263 { } movieClip 268 { } movieClip 270 { frame 1 { stop(); } instance of movieClip 255 { onClipEvent (load) { gotoAndStop(_parent.mode); } onClipEvent (enterFrame) { if (!_root.paused) { _parent.gotoAndStop(1); } } onClipEvent (press) { if (_parent.mode == 'manual') { _parent.mode = 'auto'; gotoAndStop(_parent.mode); } else { if (_parent.mode == 'auto') { _parent.mode = 'manual'; gotoAndStop(_parent.mode); } } } } } movieClip 272 { } movieClip 274 { } movieClip 276 { frame 1 { stop(); } instance gun of movieClip 272 { onClipEvent (load) { if (_root.Soundfx == 'off') { _parent.gotoAndStop(4); } } } frame 2 { gotoAndStop(1); } instance of movieClip 255 { onClipEvent (load) { gotoAndStop(_parent.mode); } onClipEvent (enterFrame) { if (!_root.paused) { _parent.gotoAndStop(1); } } onClipEvent (press) { if (_parent.mode == 'manual') { _parent.mode = 'auto'; gotoAndStop(_parent.mode); } else { if (_parent.mode == 'auto') { _parent.mode = 'manual'; gotoAndStop(_parent.mode); } } } } frame 4 { gotoAndStop(1); } } movieClip 296 { frame 17 { stop(); } } movieClip 297 { frame 1 { stop(); } frame 2 { if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('bullet4explosion'); explosionSound.start(); } } frame 25 { stop(); removeMovieClip(this); } } movieClip 299 { } movieClip 301 { } movieClip 308 { frame 1 { stop(); fire = false; } frame 2 { if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('dooropen'); explosionSound.start(); } } frame 30 { stop(); fire = true; } frame 31 { fire = false; } frame 90 { gotoAndStop(1); } instance of movieClip 255 { onClipEvent (load) { gotoAndStop(_parent.mode); } onClipEvent (enterFrame) { if (!_root.paused) { _parent.gotoAndStop(1); } } onClipEvent (press) { if (_parent.mode == 'manual') { _parent.mode = 'auto'; gotoAndStop(_parent.mode); } else { if (_parent.mode == 'auto') { _parent.mode = 'manual'; gotoAndStop(_parent.mode); } } } } } movieClip 310 { } movieClip 312 { } movieClip 314 { frame 1 { stop(); } } button 319 { on (press) { _root.build = false; play(); _root.paused = false; c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } } } button 320 { on (rollOver) { _root.selectedturretframe = 1; _root.selectedturretspd = 6; _root.selectedturretdam = 5; _root.selectedturretcost = _root.turret1cost; _root.selectedturretinfo = 'Basic turret'; } on (press) { _root.newTurret(1); } } button 321 { on (rollOver) { _root.selectedturretframe = 2; _root.selectedturretspd = 4; _root.selectedturretdam = 2; _root.selectedturretcost = _root.turret2cost; _root.selectedturretinfo = 'EMP Shell slows enemy'; } on (press) { _root.newTurret(2); } } button 322 { on (rollOver) { _root.selectedturretframe = 5; _root.selectedturretspd = 0; _root.selectedturretdam = 0; _root.selectedturretcost = _root.turret6cost; _root.selectedturretinfo = 'Slowly makes income'; } on (press) { _root.newTurret(5); } } button 323 { on (rollOver) { _root.selectedturretframe = 6; _root.selectedturretspd = 0; _root.selectedturretdam = 0; _root.selectedturretcost = _root.turret5cost; _root.selectedturretinfo = 'Makes auto turrets better'; } on (press) { _root.newTurret(6); } } button 324 { on (rollOver) { _root.selectedturretframe = 4; _root.selectedturretspd = 1; _root.selectedturretdam = 10; _root.selectedturretcost = _root.turret4cost; _root.selectedturretinfo = 'Missile silo'; } on (press) { _root.newTurret(4); } } button 325 { on (rollOver) { _root.selectedturretframe = 3; _root.selectedturretspd = 10; _root.selectedturretdam = 3; _root.selectedturretcost = _root.turret3cost; _root.selectedturretinfo = 'Fast firing'; } on (press) { _root.newTurret(3); } } movieClip 328 { frame 1 { stop(); this.swapDepths(2009); _root.selectedturretframe = 0; _name = 'build1'; } instance of movieClip 242 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedturretspd + 1); } } instance of movieClip 242 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedturretdam + 1); } } instance of movieClip 256 { onClipEvent (rollOver) { _root.selectedturretframe = 1; _root.selectedturretspd = 6; _root.selectedturretdam = 5; _root.selectedturretcost = 100; _root.selectedturretinfo = 'Basic turret'; } onClipEvent (press) { _root.newTurret(1); } } instance of movieClip 270 { onClipEvent (rollOver) { _root.selectedturretframe = 3; _root.selectedturretspd = 10; _root.selectedturretdam = 3; _root.selectedturretcost = 400; _root.selectedturretinfo = 'Fast firing'; } onClipEvent (press) { _root.newTurret(3); } } instance of movieClip 276 { onClipEvent (rollOver) { _root.selectedturretframe = 2; _root.selectedturretspd = 4; _root.selectedturretdam = 2; _root.selectedturretcost = 800; _root.selectedturretinfo = 'EMP Shell slows enemy'; } onClipEvent (press) { _root.newTurret(2); } } instance of movieClip 308 { onClipEvent (rollOver) { _root.selectedturretframe = 4; _root.selectedturretspd = 1; _root.selectedturretdam = 10; _root.selectedturretcost = 600; _root.selectedturretinfo = 'Missile silo'; } onClipEvent (press) { _root.newTurret(4); } } instance of movieClip 310 { onClipEvent (rollOver) { _root.selectedturretframe = 5; _root.selectedturretspd = 0; _root.selectedturretdam = 0; _root.selectedturretcost = 1000; _root.selectedturretinfo = 'Slowly makes income'; } onClipEvent (press) { _root.newTurret(5); } } instance of movieClip 312 { onClipEvent (rollOver) { _root.selectedturretframe = 6; _root.selectedturretspd = 0; _root.selectedturretdam = 0; _root.selectedturretcost = 1000; _root.selectedturretinfo = 'Makes auto turrets better'; } onClipEvent (press) { _root.newTurret(6); } } instance of movieClip 314 { onClipEvent (enterFrame) { if (_root.build == false && _parent._currentframe != 1 && _parent._currentframe != 20) { _parent.play(); } gotoAndStop(_root.selectedturretframe + 1); } } frame 11 { stop(); } frame 19 { gotoAndStop(1); } } instance of movieClip 328 { onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11) { play(); } } } } button 333 { on (press) { if (_root.paused) { if (_root.build) { _root.build = false; c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } } _root.paused = false; } else { _root.paused = true; } } } button 334 { on (press) { if (_root.build) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } _root.build = false; _root.paused = false; } else { _root.build = true; _root.paused = true; } } } button 335 { on (press) { _root.quit = true; } } movieClip 337 { } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } button 341 { on (press) { _root.quit = false; } } button 342 { on (press) { _root.quit = false; _root.lose(); } } movieClip 343 { } instance of movieClip 343 { onClipEvent (load) { _visible = false; } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root.wave[5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root.wave[5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { target = ['enemy' + i]; ++_root[target].gunslockedon; gottarget = true; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root.wave[5]) { wait = true; break; } } else { i = random(_root.wave[5]); } ++i; } } } } } } } } } movieClip 350 { } movieClip 351 { frame 1 { stop(); _y = _y + 20; } frame 4 { if (!_root['profile' + _root.profilenumber + 'achievement21']) { _root['profile' + _root.profilenumber + 'achievement21'] = true; _root.achievement.gotoAndStop(21); _root.achievement.timer = 30; } if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('enemy1explosion'); explosionSound.start(); } } frame 26 { ++_root.dead; this.removeMovieClip(); } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root.wave[5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root.wave[5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { target = ['enemy' + i]; ++_root[target].gunslockedon; gottarget = true; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root.wave[5]) { wait = true; break; } } else { i = random(_root.wave[5]); } ++i; } } } } } } } } } movieClip 359 { frame 1 { stop(); } frame 2 { this.dodamage = true; onEnterFrame = function () { _alpha = _alpha - 3; _y = _y - 2; }; if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('bullet1explosion'); explosionSound.start(); } } frame 3 { dodamage = false; } frame 25 { this.removeMovieClip(); } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } movieClip 365 { } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } movieClip 367 { } movieClip 368 { frame 1 { stop(); if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('bullet3sound'); explosionSound.start(); } } instance of movieClip 367 { onClipEvent (load) { if (_parent._name == 'missle2') { _parent.gotoAndStop(19); } } } frame 2 { if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('bullet3explosion'); explosionSound.start(); } } frame 17 { stop(); removeMovieClip(this); } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root.wave[5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root.wave[5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { target = ['enemy' + i]; ++_root[target].gunslockedon; gottarget = true; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root.wave[5]) { wait = true; break; } } else { i = random(_root.wave[5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root.wave[5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root.wave[5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { target = ['enemy' + i]; ++_root[target].gunslockedon; gottarget = true; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root.wave[5]) { wait = true; break; } } else { i = random(_root.wave[5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } movieClip 370 { frame 1 { stop(); _y = _y + 20; } frame 2 { if (!_root['profile' + _root.profilenumber + 'achievement22']) { _root['profile' + _root.profilenumber + 'achievement22'] = true; _root.achievement.gotoAndStop(22); _root.achievement.timer = 30; } if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('enemy2explosion'); explosionSound.start(); } } frame 21 { ++_root.dead; this.removeMovieClip(); } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } movieClip 372 { frame 1 { stop(); _y = _y + 20; } frame 2 { if (!_root['profile' + _root.profilenumber + 'achievement23']) { _root['profile' + _root.profilenumber + 'achievement23'] = true; _root.achievement.gotoAndStop(23); _root.achievement.timer = 30; } if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('enemy3explosion'); explosionSound.start(); } } frame 57 { ++_root.dead; this.removeMovieClip(); } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } movieClip 374 { frame 1 { stop(); _y = _y + 20; } frame 2 { if (!_root['profile' + _root.profilenumber + 'achievement24']) { _root['profile' + _root.profilenumber + 'achievement24'] = true; _root.achievement.gotoAndStop(24); _root.achievement.timer = 30; } if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('enemy1explosion'); explosionSound.start(); } } frame 20 { ++_root.dead; this.removeMovieClip(); } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } movieClip 376 { frame 1 { stop(); _y = _y + 20; } frame 2 { if (!_root['profile' + _root.profilenumber + 'achievement25']) { _root['profile' + _root.profilenumber + 'achievement25'] = true; _root.achievement.gotoAndStop(25); _root.achievement.timer = 30; } if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('enemy2explosion'); explosionSound.start(); } } frame 23 { ++_root.dead; this.removeMovieClip(); } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } movieClip 382 { frame 1 { stop(); } frame 2 { play(); if (_root.SOUNDS) { explosionSound = new Sound(this); explosionSound.attachSound('bullet2explosion'); explosionSound.start(); } } frame 5 { this.removeMovieClip(); } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.2) { _root['enemy' + k].speed = 0.2; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } frame 109 { function newwave() { ++wavecount; if (!_root['profile' + _root.profilenumber + 'achievement9']) { _root['profile' + _root.profilenumber + 'achievement9'] = true; _root.achievement.gotoAndStop(9); _root.achievement.timer = 30; } if (wavecount == 6) { if (!_root['profile' + _root.profilenumber + 'achievement10']) { _root['profile' + _root.profilenumber + 'achievement10'] = true; _root.achievement.gotoAndStop(10); _root.achievement.timer = 30; } } if (wavecount == 11) { if (!_root['profile' + _root.profilenumber + 'achievement11']) { _root['profile' + _root.profilenumber + 'achievement11'] = true; _root.achievement.gotoAndStop(11); _root.achievement.timer = 30; } } if (wavecount == 21) { if (!_root['profile' + _root.profilenumber + 'achievement12']) { _root['profile' + _root.profilenumber + 'achievement12'] = true; _root.achievement.gotoAndStop(12); _root.achievement.timer = 30; } } _root.wave = new Array(0, 0, 0, 0, 0, 0, 0); while (credits > 0) { x = random(78); if (x < 40) { if (_root.wavecount > 0) { ++_root.wave[0]; ++_root.wave[5]; } --credits; } else { if (x < 60) { if (credits >= 2) { if (_root.wavecount > 3) { ++_root.wave[1]; ++_root.wave[5]; credits -= 2; } } } else { if (x < 70) { if (credits >= 4) { if (_root.wavecount > 6) { ++_root.wave[2]; ++_root.wave[5]; credits -= 4; } } } else { if (x < 75) { if (credits >= 5) { if (_root.wavecount > 9) { ++_root.wave[3]; ++_root.wave[5]; credits -= 5; } } } else { if (credits >= 6) { if (_root.wavecount > 12) { ++_root.wave[4]; ++_root.wave[5]; credits -= 6; } } } } } } } _root.wave[6] = 30; } function lose() { play(); lost = true; trace('LOST'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); credits = 5; oldcredits = 5; creditseachwave = 1; wavecount = 1; _root.enemies = new Array(); _root.wave = new Array(5, 0, 0, 0, 0, 5, 30); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 240) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root.wave[j] > 0) { if (random(_root.wave[6]) == 0) { --_root.wave[j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root.wave[5]) { _root.nextwave.play(); trace('NEXT WAVE'); creditseachwave *= 1.5; credits = oldcredits + Math.round(creditseachwave); oldcredits = credits; newwave(); dead = 0; ec = 0; } } }; } movieClip 384 { } movieClip 385 { } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } movieClip 388 { frame 1 { stop(); } } frame 110 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); } movieClip 399 { frame 1 { if (_root.Score >= 2000) { if (!_root['profile' + _root.profilenumber + 'achievement13']) { _root['profile' + _root.profilenumber + 'achievement13'] = true; _root.achievement.gotoAndStop(13); _root.achievement.timer = 30; } } if (_root.Score >= 75000) { if (!_root['profile' + _root.profilenumber + 'achievement14']) { _root['profile' + _root.profilenumber + 'achievement14'] = true; _root.achievement.gotoAndStop(14); _root.achievement.timer = 30; } } if (_root.Score >= 18000) { if (!_root['profile' + _root.profilenumber + 'achievement15']) { _root['profile' + _root.profilenumber + 'achievement15'] = true; _root.achievement.gotoAndStop(15); _root.achievement.timer = 30; } } if (_root.Score >= 30000) { if (!_root['profile' + _root.profilenumber + 'achievement16']) { _root['profile' + _root.profilenumber + 'achievement16'] = true; _root.achievement.gotoAndStop(16); _root.achievement.timer = 30; } } if (_root.Score >= 60000) { if (!_root['profile' + _root.profilenumber + 'achievement17']) { _root['profile' + _root.profilenumber + 'achievement17'] = true; _root.achievement.gotoAndStop(16); _root.achievement.timer = 30; } } _root.paused = false; _root['profile' + _root.profilenumber + 'enemiesdestroyed'] += _root.enemiesdestroyed; _root['profile' + _root.profilenumber + 'totalscore'] += _root.Score; _root.save(_root.profilenumber); } } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); } } frame 158 { stop(); } button 400 { on (press) { play(); targetframe = 'playgame'; } } frame 174 { gotoAndPlay(_root.targetframe); } frame 175 { playermoney = 0; enemiesdestroyed = 0; moneyearned = 0; distancegone = 0; _root.liveslost = 0; sc = 0; smc = 0; ec = 0; tc = 0; wave = 1; timer = -1; dead = 0; build = true; } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 343 { onClipEvent (load) { _visible = false; } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } instance build of movieClip 328 { onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11 && _currentframe != 30) { play(); } } } } movieClip 405 { } button 407 { on (press) { nextFrame(); } } button 410 { on (press) { prevFrame(); } } movieClip 414 { } button 415 { on (press) { prevFrame(); } } movieClip 426 { frame 1 { stop(); } instance of movieClip 405 { onClipEvent (enterFrame) { _root.paused = true; _root.build = false; _root.build.gotoAndStop(1); } } instance of movieClip 405 { onClipEvent (load) { _root.playermoney += 100; } onClipEvent (enterFrame) { _root.paused = true; _root.sell = false; if (_root.build) { _parent.nextFrame(); } } } instance of movieClip 405 { onClipEvent (enterFrame) { _root.paused = true; _root.sell = false; if (_root.Turret1.drag) { _parent.nextFrame(); } } } instance of movieClip 405 { onClipEvent (enterFrame) { _root.paused = true; _root.sell = false; if (_root.playermoney == 0) { _parent.nextFrame(); } } } instance of movieClip 405 { onClipEvent (enterFrame) { _root.paused = true; _root.sell = false; } } instance of movieClip 405 { onClipEvent (load) { _root.playermoney += 100; } onClipEvent (enterFrame) { _root.paused = true; _root.sell = false; if (_root.tc > 1) { _parent.nextFrame(); } } } instance of movieClip 405 { onClipEvent (load) { } onClipEvent (enterFrame) { _root.paused = true; if (!_root.build) { _parent.nextFrame(); } } } instance of movieClip 405 { onClipEvent (load) { } onClipEvent (enterFrame) { _root.paused = false; if (_root.wave == 2) { _root.paused = true; _parent.nextFrame(); } } } frame 10 { _root.playermoney += 200; if (!_root['profile' + _root.profilenumber + 'achievement1']) { _root['profile' + _root.profilenumber + 'achievement1'] = true; _root.achievement.gotoAndStop(1); _root.achievement.timer = 30; } } instance of movieClip 405 { onClipEvent (load) { } onClipEvent (enterFrame) { if (!_root.paused) { _parent.nextFrame(); } } } frame 11 { stop(); } } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; ++_root[target].gunslockedon; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } frame 189 { function lose() { play(); lost = true; trace('LOST'); } function win() { play(); lost = false; trace('WON'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); _root.wave1 = new Array(3, 0, 0, 0, 0, 3, 80); _root.wave2 = new Array(6, 0, 0, 0, 0, 6, 80); _root.wave3 = new Array(10, 0, 0, 0, 0, 10, 60); _root.wave4 = new Array(15, 0, 0, 0, 0, 15, 40); _root.wave5 = new Array(30, 0, 0, 0, 0, 30, 30); waves = 5; _root.enemies = new Array(); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 240) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root['wave' + wave][j] > 0) { if (random(_root['wave' + wave][6]) == 0) { --_root['wave' + wave][j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root['wave' + wave][5]) { _root.nextwave.play(); trace('NEXT WAVE'); dead = 0; ++wave; ec = 0; trace(wave); if (wave > waves) { paused = true; waves = 100000; win(); } } } }; } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } frame 190 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); removeMovieClip(_root.tut1); } frame 211 { save(_root.profilenumber); } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); if (_root.lost) { gotoAndStop(1); } else { _root['profile' + _root.profilenumber + 'level1completed'] = true; if (!_root['profile' + _root.profilenumber + 'achievement2']) { _root['profile' + _root.profilenumber + 'achievement2'] = true; _root.achievement.gotoAndStop(2); _root.achievement.timer = 30; } gotoAndStop(2); } } } frame 238 { stop(); } button 431 { on (press) { play(); targetframe = 'campaign'; } } frame 254 { gotoAndPlay(_root.targetframe); } frame 255 { playermoney = 400; turret1cost = 100; turret2cost = 300; turret3cost = 400; turret4cost = 600; turret5cost = 1000; turret6cost = 1000; distancegone = 0; enemiesdestroyed = 0; moneyearned = 0; _root.liveslost = 0; sc = 0; smc = 0; ec = 0; tc = 0; wave = 1; timer = -1; dead = 0; build = true; } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 343 { onClipEvent (load) { _visible = false; } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } instance build of movieClip 328 { onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11) { play(); } } } } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; ++_root[target].gunslockedon; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } frame 269 { function lose() { play(); lost = true; trace('LOST'); } function win() { play(); lost = false; trace('WON'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); _root.wave1 = new Array(3, 0, 0, 0, 0, 3, 80); _root.wave2 = new Array(5, 0, 0, 0, 0, 5, 40); _root.wave3 = new Array(8, 2, 0, 0, 0, 10, 40); _root.wave4 = new Array(10, 5, 0, 0, 0, 15, 20); _root.wave5 = new Array(15, 10, 0, 0, 0, 25, 60); waves = 5; _root.enemies = new Array(); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 240) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root['wave' + wave][j] > 0) { if (random(_root['wave' + wave][6]) == 0) { --_root['wave' + wave][j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root['wave' + wave][5]) { _root.nextwave.play(); trace('NEXT WAVE'); dead = 0; ++wave; ec = 0; trace(wave); if (wave > waves) { paused = true; waves = 100000; win(); } } } }; } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } frame 270 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); if (_root.lost) { gotoAndStop(1); } else { _root['profile' + _root.profilenumber + 'level2completed'] = true; if (!_root['profile' + _root.profilenumber + 'achievement3']) { _root['profile' + _root.profilenumber + 'achievement3'] = true; _root.achievement.gotoAndStop(3); _root.achievement.timer = 30; } gotoAndStop(2); } } } frame 318 { stop(); } frame 334 { gotoAndPlay(_root.targetframe); } frame 335 { playermoney = 1000; turret1cost = 100; turret2cost = 300; turret3cost = 400; turret4cost = 600; turret5cost = 1000; turret6cost = 1000; distancegone = 0; enemiesdestroyed = 0; moneyearned = 0; _root.liveslost = 0; sc = 0; smc = 0; ec = 0; tc = 0; wave = 1; timer = -1; dead = 0; build = true; } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 343 { onClipEvent (load) { _visible = false; this.swapDepths(2003); } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } instance build of movieClip 328 { onClipEvent (load) { this.swapDepths(2000); } onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11) { play(); } } } } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } movieClip 438 { } instance of movieClip 438 { onClipEvent (load) { this.swapDepths(2001); } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; ++_root[target].gunslockedon; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } frame 349 { function lose() { play(); lost = true; trace('LOST'); } function win() { play(); lost = false; trace('WON'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); _root.wave1 = new Array(5, 2, 0, 0, 0, 7, 30); _root.wave2 = new Array(10, 5, 0, 0, 0, 15, 40); _root.wave3 = new Array(10, 5, 1, 0, 0, 16, 40); _root.wave4 = new Array(10, 10, 3, 0, 0, 23, 20); _root.wave5 = new Array(30, 20, 5, 0, 0, 55, 70); waves = 5; _root.enemies = new Array(); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 240) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root['wave' + wave][j] > 0) { if (random(_root['wave' + wave][6]) == 0) { --_root['wave' + wave][j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root['wave' + wave][5]) { _root.nextwave.play(); trace('NEXT WAVE'); dead = 0; ++wave; ec = 0; trace(wave); if (wave > waves) { paused = true; waves = 100000; win(); } } } }; } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } frame 350 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); if (_root.lost) { gotoAndStop(1); } else { _root['profile' + _root.profilenumber + 'level3completed'] = true; if (!_root['profile' + _root.profilenumber + 'achievement4']) { _root['profile' + _root.profilenumber + 'achievement4'] = true; _root.achievement.gotoAndStop(4); _root.achievement.timer = 30; } gotoAndStop(2); } } } frame 398 { stop(); } frame 414 { gotoAndPlay(_root.targetframe); } frame 415 { playermoney = 1600; turret1cost = 100; turret2cost = 300; turret3cost = 400; turret4cost = 600; turret5cost = 1000; turret6cost = 1000; distancegone = 0; enemiesdestroyed = 0; moneyearned = 0; _root.liveslost = 0; sc = 0; smc = 0; ec = 0; tc = 0; wave = 1; timer = -1; dead = 0; build = true; } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 343 { onClipEvent (load) { _visible = false; this.swapDepths(2003); } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } instance build of movieClip 328 { onClipEvent (load) { this.swapDepths(2000); } onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11) { play(); } } } } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } instance of movieClip 438 { onClipEvent (load) { this.swapDepths(2001); } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; ++_root[target].gunslockedon; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } frame 429 { function lose() { play(); lost = true; trace('LOST'); } function win() { play(); lost = false; trace('WON'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); _root.wave1 = new Array(10, 2, 0, 0, 0, 12, 30); _root.wave2 = new Array(10, 2, 0, 0, 0, 12, 40); _root.wave3 = new Array(10, 3, 2, 0, 0, 15, 40); _root.wave4 = new Array(10, 4, 2, 2, 0, 18, 20); _root.wave5 = new Array(30, 4, 3, 2, 0, 39, 70); waves = 5; _root.enemies = new Array(); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 240) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root['wave' + wave][j] > 0) { if (random(_root['wave' + wave][6]) == 0) { --_root['wave' + wave][j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root['wave' + wave][5]) { _root.nextwave.play(); trace('NEXT WAVE'); dead = 0; ++wave; ec = 0; trace(wave); if (wave > waves) { paused = true; waves = 100000; win(); } } } }; } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } frame 430 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); if (_root.lost) { gotoAndStop(1); } else { _root['profile' + _root.profilenumber + 'level4completed'] = true; if (!_root['profile' + _root.profilenumber + 'achievement5']) { _root['profile' + _root.profilenumber + 'achievement5'] = true; _root.achievement.gotoAndStop(5); _root.achievement.timer = 30; } gotoAndStop(2); } } } frame 478 { stop(); } frame 494 { gotoAndPlay(_root.targetframe); } frame 495 { playermoney = 2400; turret1cost = 100; turret2cost = 300; turret3cost = 400; turret4cost = 600; turret5cost = 1000; turret6cost = 1000; distancegone = 0; enemiesdestroyed = 0; moneyearned = 0; _root.liveslost = 0; sc = 0; smc = 0; ec = 0; tc = 0; wave = 1; timer = -1; dead = 0; build = true; } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 343 { onClipEvent (load) { _visible = false; this.swapDepths(2003); } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } instance build of movieClip 328 { onClipEvent (load) { this.swapDepths(2000); } onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11) { play(); } } } } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } instance of movieClip 438 { onClipEvent (load) { this.swapDepths(2001); } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; ++_root[target].gunslockedon; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } frame 509 { function lose() { play(); lost = true; trace('LOST'); } function win() { play(); lost = false; trace('WON'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); _root.wave1 = new Array(10, 2, 1, 0, 0, 13, 30); _root.wave2 = new Array(12, 3, 2, 0, 0, 17, 40); _root.wave3 = new Array(14, 3, 3, 2, 0, 22, 40); _root.wave4 = new Array(15, 5, 3, 3, 1, 27, 20); _root.wave5 = new Array(30, 4, 3, 2, 3, 42, 70); waves = 5; _root.enemies = new Array(); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 240) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root['wave' + wave][j] > 0) { if (random(_root['wave' + wave][6]) == 0) { --_root['wave' + wave][j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root['wave' + wave][5]) { _root.nextwave.play(); trace('NEXT WAVE'); dead = 0; ++wave; ec = 0; trace(wave); if (wave > waves) { paused = true; waves = 100000; win(); } } } }; } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } frame 510 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); if (_root.lost) { gotoAndStop(1); } else { _root['profile' + _root.profilenumber + 'level5completed'] = true; if (!_root['profile' + _root.profilenumber + 'achievement6']) { _root['profile' + _root.profilenumber + 'achievement6'] = true; _root.achievement.gotoAndStop(6); _root.achievement.timer = 30; } gotoAndStop(2); } } } frame 558 { stop(); } frame 574 { gotoAndPlay(_root.targetframe); } frame 575 { playermoney = 3000; turret1cost = 100; turret2cost = 300; turret3cost = 400; turret4cost = 600; turret5cost = 1000; turret6cost = 1000; distancegone = 0; enemiesdestroyed = 0; moneyearned = 0; _root.liveslost = 0; sc = 0; smc = 0; ec = 0; tc = 0; wave = 1; timer = -1; dead = 0; build = true; } instance sq9 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq10 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq11 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq12 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq13 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq1 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq2 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq3 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq4 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq5 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 343 { onClipEvent (load) { _visible = false; this.swapDepths(2003); } onClipEvent (enterFrame) { if (_root.quit) { this.swapDepths(20000); _visible = true; } else { _visible = false; } } } instance sq14 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq15 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq16 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq6 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq7 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance sq8 of movieClip 218 { onClipEvent (load) { timer = 0; } onClipEvent (enterFrame) { if (_currentframe == 2) { if (timer == 0) { timer = 1; gotoAndStop(1); } else { --timer; } } } } instance of movieClip 236 { onClipEvent (load) { _visible = false; this.swapDepths(2004); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } if (_root.build) { _root.paused = true; } if (_root.paused) { _visible = true; } else { _visible = false; } } } instance build of movieClip 328 { onClipEvent (load) { this.swapDepths(2000); } onClipEvent (enterFrame) { if (_root.build) { if (_currentframe != 11) { play(); } } } } instance of movieClip 337 { onClipEvent (load) { startDrag(this, true); } onClipEvent (enterFrame) { if (_root.sell) { gotoAndStop(2); } else { gotoAndStop(1); } } } instance of movieClip 438 { onClipEvent (load) { this.swapDepths(2001); } } instance Enemy1 of movieClip 351 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy1') { speed = _root.enemy1speed; hp = _root.enemy1hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy1worth; } onClipEvent (enterFrame) { if (_name != 'Enemy1') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy2 of movieClip 370 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy2') { speed = _root.enemy2speed; hp = _root.enemy2hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy2worth; } onClipEvent (enterFrame) { if (_name != 'Enemy2') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { toldtoplay = true; ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; gotoAndPlay(2); speed = 0; } } } } } } instance Enemy3 of movieClip 372 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy3') { speed = _root.enemy3speed; hp = _root.enemy3hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy3worth; } onClipEvent (enterFrame) { if (_name != 'Enemy3') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; play(); speed = 0; } } } } } } instance Enemy4 of movieClip 374 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy4') { speed = _root.enemy4speed; hp = _root.enemy4hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy4worth; } onClipEvent (enterFrame) { if (_name != 'Enemy4') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; toldtoplay = true; _root.playermoney += worth; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance Enemy5 of movieClip 376 { onClipEvent (load) { gunslockedon = 0; X = random(2); if (_name != 'Enemy5') { speed = _root.enemy5speed; hp = _root.enemy5hp; _y = random(200) + 20; _x = 580; } worth = _root.enemy5worth; } onClipEvent (enterFrame) { if (_name != 'Enemy5') { if (!_root.paused) { if (_x < 0) { --_root.lives; ++_root.liveslost; ++_root.dead; this.swapDepths(200); removeMovieClip(this); toldtoplay = true; } _x = _x - speed; if (hp <= 0) { if (!toldtoplay) { ++_root.enemiesdestroyed; _root.moneyearned += worth; _root.playermoney += worth; toldtoplay = true; gotoAndPlay(4); speed = 0; } } else { if (hp <= 3) { gotoAndStop(X + 2); } } } } } } instance smoke of movieClip 365 { onClipEvent (load) { X = 100; gotoAndStop(random(5) + 1); timer = 3; _alpha = 0; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'smoke') { if (timer == 0) { if (!setalpha) { _alpha = 100; setalpha = true; } _alpha = _alpha - 5; if (_alpha == 0) { this.removeMovieClip(); } } else { --timer; } } } } } instance shell of movieClip 359 { onClipEvent (load) { spd = 10; damage = _root.turret1damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'shell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance missle of movieClip 297 { onClipEvent (load) { spd = 3; damage = _root.turret4damage; turnspd = 3; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { play(); smoke = true; spd = 0; if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.8; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 80); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance missle2 of movieClip 368 { onClipEvent (load) { spd = 5; damage = _root.turret3damage; turnspd = 6; if (_root.accurate) { Xx = 0; Yy = 0; } else { Xx = random(10); Yy = random(10); } } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'missle2') { Xdiff = TargetX - _x + Xx - 10; Ydiff = TargetY - _y + Yy - 10; radAngle = Math.atan2(Ydiff, Xdiff); Targetrotation = int(radAngle * 360 / 6.283185 + 90); if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (Targetrotation > _rotation - turnspd / 2) { _rotation = _rotation + turnspd; } else { if (Targetrotation < _rotation + turnspd / 2) { _rotation = _rotation - turnspd; } } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } if (this.hitTest(TargetX - 5 + Xx, TargetY - 5 + Yy, true)) { smoke = true; spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].hp -= damage; } ++k; } } } else { if (!smoke) { duplicateMovieClip(_root.smoke, 'smoke' + _root.smc, _root.smc + 140); _root['smoke' + _root.smc]._x = _x + random(4) - 2; _root['smoke' + _root.smc]._y = _y + random(4); ++_root.smc; } } } } } } instance empshell of movieClip 382 { onClipEvent (load) { spd = 5; damage = _root.turret2damage; } onClipEvent (enterFrame) { if (!_root.paused) { if (_name != 'empshell') { if (_x > 600 || _x < 0 || _y < 0 || _y > 500) { removeMovieClip(this); } if (_rotation > 180) { _y = _y + spd * Math.cos(0.01745329 * _rotation); _x = _x - spd * Math.sin(0.01745329 * _rotation); } else { _y = _y - spd * Math.cos(0.01745329 * _rotation); _x = _x + spd * Math.sin(0.01745329 * _rotation); } if (!testHIT) { testHIT = true; k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { hitT = true; } ++k; } } else { testHIT = false; } if (hitT) { spd = 0; play(); if (!bang) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } if (_y < Targety + spd + 10 && _y > Targety - spd) { spd = 0; play(); if (!bang) { bang = true; nextFrame(); k = 0; while (k < _root.ec) { if (_root['enemy' + k].hitTest(this)) { _root['enemy' + k].speed *= 0.5; if (_root['enemy' + k].speed < 0.5) { _root['enemy' + k].speed = 0.5; } _root['enemy' + k].hp -= damage; } ++k; } } } } } } } instance Turret1 of movieClip 256 { onClipEvent (load) { firespd = _root.turret1spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret1') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret1cost) { _root.playermoney -= _root.turret1cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret1cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x + 30) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90) - 45; if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; ++_root[target].gunslockedon; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret3 of movieClip 270 { onClipEvent (load) { firespd = _root.turret3spd; firetime = 0; timer = 0; i = 0; mode = 'manual'; } onClipEvent (enterFrame) { if (_name == 'Turret3') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret3cost) { _root.playermoney -= _root.turret3cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(2); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret3cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x + 5; _root['Shell' + _root.sc]._y = _y - 20; _root['Shell' + _root.sc]._rotation = 45; _root['Shell' + _root.sc].mode = 'mouse'; _root['Shell' + _root.sc].TargetY = _root._ymouse; _root['Shell' + _root.sc].TargetX = _root._xmouse; ++_root.sc; } } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < 12) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; duplicateMovieClip(_root.missle2, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = 45; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 4; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret6 of movieClip 312 { onClipEvent (enterFrame) { if (_name == 'Turret6') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret6cost) { _root.playermoney -= _root.turret6cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + _root.tc].S = i; _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret6cost; removeMovieClip(this); } } _root.accurate = true; } } } instance Turret2 of movieClip 276 { onClipEvent (load) { firespd = _root.turret2spd; firetime = 0; timer = 0; mode = 'auto'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret2') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret2cost) { _root.playermoney -= _root.turret2cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(3); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret2cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); duplicateMovieClip(_root.shell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = _root._ymouse; ++_root.sc; } } Xd = _root._xmouse - _x; Yd = _root._ymouse - _y; radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (gun._rotation < -41) { gun._rotation = -41; } if (gun._rotation > 45) { gun._rotation = 45; } } else { if (mode == 'auto') { if (gottarget) { if (_root[target]._x < _x - 40) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + wave][5] - 1) { wait = true; } } } if (gottarget) { Yd = _root[target]._y - _y; Xd = _root[target]._x + _root[target].speed * Yd / 5 - _x - 20 + random(10); radAngle = Math.atan2(Yd, Xd); gun._rotation = int(radAngle * 360 / 6.283185 + 90); if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); duplicateMovieClip(_root.empshell, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation; _root['Shell' + _root.sc].Targety = _root[target]._y; ++_root.sc; } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret4 of movieClip 308 { onClipEvent (load) { firespd = _root.turret4spd; firetime = 0; timer = 0; mode = 'manual'; i = 0; } onClipEvent (enterFrame) { if (_name == 'Turret4') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 0; while (i < 19) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (i != 1) { if (i != 9) { if (!_root['sq' + (i - 1)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret4cost) { _root.playermoney -= _root.turret4cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.paused) { gotoAndStop(100); if (_root.sell) { gotoAndStop(1); if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret4cost; removeMovieClip(this); } } } else { if (firetime > 0) { --firetime; } if (mode == 'manual') { if (fire) { play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; _root['Shell' + _root.sc]._rotation = gun._rotation + 45; _root['Shell' + _root.sc].Targety = Yy; _root['Shell' + _root.sc].Targetx = Xx; ++_root.sc; fire = false; } if (Key.isDown(1)) { if (firetime == 0) { firetime = firespd; play(); Yy = _root._ymouse - 20 + random(10); Xx = _root._xmouse - 20 + random(10); } } } else { if (mode == 'auto') { if (fire) { fire = false; play(); duplicateMovieClip(_root.missle, 'Shell' + _root.sc, 500 + _root.sc); _root['Shell' + _root.sc]._x = _x; _root['Shell' + _root.sc]._y = _y; Yd = _root[target]._y - _y; _root['Shell' + _root.sc].TargetX = _root[target]._x + _root[target].speed * Yd / 3; _root['Shell' + _root.sc].TargetY = _root[target]._y; ++_root.sc; } if (gottarget) { if (_root[target]._x < 5) { gottarget = false; } if (_root[target].hp <= 0) { gottarget = false; if (_root.dead == _root['wave' + _root.wave][5] - 1) { wait = true; } } if (firetime == 0) { if (random(2) == 1) { if (_root[target].gunslockedon > 4) { --_root[target].gunslockedon; gottarget = false; } firetime = firespd; play(); Yy = _root[target]._y - 20 + random(10); Xx = _root[target]._x - 20 + random(10); } } } else { if (!wait) { i = i; while (i < _root['wave' + _root.wave][5] + 1) { if (_root['enemy' + i].gunslockedon <= 4) { if (_root['enemy' + i]._x > 12) { if (_root['enemy' + i].hp > 0) { gottarget = true; target = ['enemy' + i]; break; } } if (i == _root.ec) { wait = true; break; } if (i == _root['wave' + _root.wave][5]) { wait = true; break; } } else { i = random(_root['wave' + _root.wave][5]); } ++i; } } } } } } } } } instance Turret5 of movieClip 310 { onClipEvent (load) { damage = 100; timer = _root.turret5spd; } onClipEvent (enterFrame) { if (_name == 'Turret5') { if (drag) { ready = false; _x = _root._xmouse; _y = _root._ymouse; i = 2; while (i < 9) { if (_root['sq' + i].hitTest(_x, _y, true)) { if (!_root['sq' + i].empty) { if (!_root['sq' + (i - 1)].empty) { if (!_root['sq' + (i + 7)].empty) { if (!_root['sq' + (i + 8)].empty) { _root['sq' + i].timer = 1; _root['sq' + i].gotoAndStop(2); _root['sq' + (i - 1)].timer = 1; _root['sq' + (i - 1)].gotoAndStop(2); _root['sq' + (i + 7)].timer = 1; _root['sq' + (i + 7)].gotoAndStop(2); _root['sq' + (i + 8)].timer = 1; _root['sq' + (i + 8)].gotoAndStop(2); _x = _root['sq' + i]._x; _y = _root['sq' + i]._y; ready = true; break; } } } } } ++i; } if (Key.isDown(1)) { if (ready) { if (_root.playermoney >= _root.turret5cost) { _root.playermoney -= _root.turret5cost; duplicateMovieClip(this, 'turret' + _root.tc, i); _root['turret' + tc].newColour.clear(); _root['turret' + _root.tc].S = i; ++_root.tc; _root['sq' + i].empty = true; _root['sq' + i].gotoAndStop(3); _root['sq' + (i - 1)].empty = true; _root['sq' + (i - 1)].gotoAndStop(3); _root['sq' + (i + 7)].empty = true; _root['sq' + (i + 7)].gotoAndStop(3); _root['sq' + (i + 8)].empty = true; _root['sq' + (i + 8)].gotoAndStop(3); _y = _y + 1000; if (!Key.isDown(32)) { drag = false; } } } } } } else { if (_root.sell) { if (Key.isDown(1) && this.hitTest(_root._xmouse, _root._ymouse, true)) { _root['sq' + S].empty = false; _root['sq' + S].gotoAndStop(1); _root['sq' + (S - 1)].empty = false; _root['sq' + (S - 1)].gotoAndStop(1); _root['sq' + (S + 8)].empty = false; _root['sq' + (S + 8)].gotoAndStop(1); _root['sq' + (S + 7)].empty = false; _root['sq' + (S + 7)].gotoAndStop(1); _root.sell = false; _root.playermoney += _root.turret5cost; removeMovieClip(this); } } if (timer == 0) { _root.playermoney += damage; timer = 300; } else { --timer; } } } } frame 589 { function lose() { play(); lost = true; trace('LOST'); } function win() { play(); lost = false; trace('WON'); } function newTurret(j) { c = 0; while (c < 7) { if (_root['Turret' + c].drag) { _root['Turret' + c].drag = false; _root['Turret' + c]._y += 1000; } ++c; } if (_root.playermoney >= _root['turret' + j + 'cost']) { _root['Turret' + j].drag = true; } } stop(); _root.wave1 = new Array(10, 0, 0, 0, 0, 10, 30); _root.wave2 = new Array(20, 0, 0, 0, 0, 20, 30); _root.wave3 = new Array(30, 0, 0, 0, 0, 30, 30); _root.wave4 = new Array(40, 0, 0, 0, 0, 40, 30); _root.wave5 = new Array(50, 0, 0, 0, 0, 50, 30); _root.wave6 = new Array(10, 3, 0, 0, 0, 13, 30); _root.wave7 = new Array(10, 5, 0, 0, 0, 15, 40); _root.wave8 = new Array(10, 7, 0, 0, 0, 17, 40); _root.wave9 = new Array(10, 8, 0, 0, 0, 18, 60); _root.wave10 = new Array(10, 10, 0, 0, 0, 20, 70); _root.wave11 = new Array(10, 3, 1, 0, 0, 14, 30); _root.wave12 = new Array(10, 3, 3, 0, 0, 16, 40); _root.wave13 = new Array(10, 3, 5, 0, 0, 18, 40); _root.wave14 = new Array(10, 3, 4, 3, 0, 20, 40); _root.wave15 = new Array(20, 6, 4, 5, 0, 35, 70); _root.wave16 = new Array(10, 4, 3, 4, 1, 22, 30); _root.wave17 = new Array(10, 4, 3, 4, 3, 24, 40); _root.wave18 = new Array(20, 5, 4, 4, 4, 37, 40); _root.wave19 = new Array(20, 5, 4, 6, 5, 40, 40); _root.wave20 = new Array(50, 6, 6, 10, 10, 84, 70); waves = 20; _root.enemies = new Array(); distance = 1000; accurate = false; onEnterFrame = function () { if (ec >= 100) { ec = 0; } if (sc >= 499) { sc = 0; } if (smc >= 249) { smc = 0; } if (!_root.paused) { j = 0; while (j < 5) { if (_root['wave' + wave][j] > 0) { if (random(_root['wave' + wave][6]) == 0) { --_root['wave' + wave][j]; duplicateMovieClip(_root['Enemy' + (j + 1)], 'enemy' + ec, ec + 30); i = 0; while (i < tc) { _root['turret' + i].wait = false; _root['turret' + i].i = 0; ++i; } ++ec; } } else { ++count; } ++j; } if (dead == _root['wave' + wave][5]) { _root.nextwave.play(); trace('NEXT WAVE'); dead = 0; ++wave; ec = 0; trace(wave); if (wave > waves) { paused = true; waves = 100000; win(); } } } }; } instance of movieClip 385 { onClipEvent (load) { gotoAndStop(3); _root.lives = 3; } onClipEvent (enterFrame) { if (_root.lives <= 0) { if (!lost) { lost = true; _root.lose(); } } gotoAndStop(_root.lives + 1); } } frame 590 { i = 0; while (i < _root.ec) { removeMovieClip(_root['enemy' + i]); ++i; } i = 0; while (i < _root.tc) { removeMovieClip(_root['turret' + i]); ++i; } i = 0; while (i < _root.sc) { removeMovieClip(_root['Shell' + i]); ++i; } i = 0; while (i < _root.smc) { removeMovieClip(_root['smoke' + i]); ++i; } removeMovieClip(_root.build1); removeMovieClip(_root.pause1); } instance of movieClip 399 { onClipEvent (load) { gotoAndStop(1); _root.Score = _root.enemiesdestroyed * _root.moneyearned / (_root.liveslost + 1); if (_root.lost) { gotoAndStop(1); } else { _root['profile' + _root.profilenumber + 'level6completed'] = true; if (!_root['profile' + _root.profilenumber + 'achievement7']) { _root['profile' + _root.profilenumber + 'achievement7'] = true; _root.achievement.gotoAndStop(7); _root.achievement.timer = 30; } gotoAndStop(2); } } } frame 638 { stop(); } frame 654 { gotoAndPlay(_root.targetframe); }
|