Frame 1
var CPMStarContentSpotID = "4391Q6C2021BA";
System.security.allowDomain("server.cpmstar.com");
adBox.loadMovie("http://server.cpmstar.com/adviewas2.swf?contentspotid=" + CPMStarContentSpotID);
function yangDiSave() {
pilihMap = 1;
score = 0;
}
function simpanData() {
Cookies = SharedObject.getLocal("InfiniteTD");
i = 1;
while (i <= simpanSemua.length) {
Cookies.data["xInfiniteData" + i] = eval (simpanSemua[i]);
i++;
}
}
function loadData() {
Cookies = SharedObject.getLocal("InfiniteTD");
i = 1;
while (i <= simpanSemua.length) {
_root[simpanSemua[i]] = Cookies.data["xInfiniteData" + i];
i++;
}
}
function backMusic() {
myMusic.stop();
myMusic = new Sound(zmusik);
myMusic.attachSound("backMusic");
myMusic.start(0, 1);
myMusic.setVolume(volume1);
myMusic.onSoundComplete = function () {
backMusic();
};
}
function backMusic2() {
myMusic.stop();
myMusic = new Sound(zmusik);
myMusic.attachSound("backMusic2");
myMusic.start(0, 1);
myMusic.setVolume(volume1);
myMusic.onSoundComplete = function () {
backMusic2();
};
}
function backGun() {
mySound = new Sound(zsound);
mySound.attachSound("backGun");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backGun2() {
mySound = new Sound(zsound);
mySound.attachSound("backGun2");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backDestroy() {
mySound = new Sound(zsound);
mySound.attachSound("backDestroy");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backDestroy2() {
mySound = new Sound(zsound);
mySound.attachSound("backDestroy2");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backMisil() {
mySound = new Sound(zsound);
mySound.attachSound("backMisil");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backKena() {
mySound = new Sound(zsound);
mySound.attachSound("backKena");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backKena2() {
mySound = new Sound(zsound);
mySound.attachSound("backKena2");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backKena3() {
mySound = new Sound(zsound);
mySound.attachSound("backKena3");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBonus1() {
mySound = new Sound(zsound);
mySound.attachSound("backBonus1");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBonus2() {
mySound = new Sound(zsound);
mySound.attachSound("backBonus2");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBonus3() {
mySound = new Sound(zsound);
mySound.attachSound("backBonus3");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBomb() {
randX = random(2);
if (randX == 0) {
mySound = new Sound(zsound);
mySound.attachSound("backBomb");
mySound.start(0, 1);
mySound.setVolume(volume2);
}
}
stop();
fscommand ("showmenu", false);
fscommand ("fullscreen", false);
fscommand ("allowscale", false);
fscommand ("trapallkeys", true);
Stage.showMenu = false;
this.onEnterFrame = function () {
persen = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
xpersen = persen + " %";
bar_mc.gotoAndStop(persen);
if (persen >= 100) {
delete this.onEnterFrame;
gotoAndStop ("completed");
}
};
musik = attachMovie("xsound", "zmusik", 290000);
sound = attachMovie("xsound", "zsound", 390000);
volume1 = 75;
volume2 = 100;
_root.qualityGame = 1;
_quality = "HIGH";
simpanSemua = new Array("", "dataKe", "pilihMap", "score");
loadData();
if (pilihMap == undefined) {
yangDiSave();
simpanData();
}
Frame 15
stop();
enter_btn.onRelease = function () {
this.enabled = false;
_urlStart = _url.indexOf("://") + 3;
_urlEnd = _url.indexOf("/", _urlStart);
domain = _url.substring(_urlStart, _urlEnd);
LastDot = domain.lastIndexOf(".") - 1;
domEnd = domain.lastIndexOf(".", LastDot) + 1;
domain = domain.substring(domEnd, domain.length);
if (domain == "belugerinstudios.com") {
gotoAndPlay (21);
} else {
gotoAndPlay (21);
}
};
Frame 21
play();
Frame 204
stop();
backMusic2();
gotoAndStop (205);
Frame 205
stop();
warning_mc._visible = false;
single_btn.onRelease = function () {
jenisMain = "single";
gotoAndStop (210);
};
arcade_btn.onRelease = function () {
jenisMain = "arcade";
if (pilihMap != 1) {
warning_mc._visible = true;
warning_mc.yes_btn.onRelease = function () {
yangDiSave();
gotoAndStop (208);
};
warning_mc.no_btn.onRelease = function () {
warning_mc._visible = false;
};
} else {
yangDiSave();
gotoAndStop (208);
}
};
continue_btn.onRelease = function () {
loadData();
jenisMain = "arcade";
gotoAndStop (211);
};
options_btn.onRelease = function () {
gotoAndStop (206);
};
credit_btn.onRelease = function () {
gotoAndStop (207);
};
high_btn.onRelease = function () {
getURL ("http://www.belugerinstudios.com/index.php?act=highscore&val=FL11041587", "_blank");
};
more_btn.onRelease = function () {
getURL ("http://www.belugerinstudios.com/", "_blank");
};
facebook_btn.onRelease = function () {
getURL ("http://www.facebook.com/pages/Belugerin-Studios/145908438809435", "_blank");
};
Frame 206
function cekSpeedQuality() {
i = 1;
while (i <= 3) {
this["speed" + i].angka = i;
this["quality" + i].angka = i;
this["speed" + i].gotoAndStop(1);
this["quality" + i].gotoAndStop(1);
this["speed" + i].onRelease = klikSpeed;
this["quality" + i].onRelease = klikQuality;
this["speed" + i].onRollOver = function () {
over();
};
this["quality" + i].onRollOver = function () {
over();
};
i++;
}
this["speed" + _root.speedGame].gotoAndStop(2);
this["quality" + _root.qualityGame].gotoAndStop(2);
}
function klikSpeed() {
klik();
indi = new String(this);
_root.speedGame = Number(indi.substr(indi.length - 1, 1));
cekSpeedQuality();
}
function klikQuality() {
klik();
indi = new String(this);
_root.qualityGame = Number(indi.substr(indi.length - 1, 1));
if (_root.qualityGame == 1) {
_quality = "HIGH";
} else if (_root.qualityGame == 2) {
_quality = "MEDIUM";
} else if (_root.qualityGame == 3) {
_quality = "LOW";
}
cekSpeedQuality();
}
stop();
reset_mc._visible = false;
quit_btn.onRelease = function () {
removeMovieClip(infoBox);
gotoAndStop (205);
};
reset_btn.onRelease = function () {
reset_mc._visible = true;
reset_mc.yes_btn.onRelease = function () {
initAwal();
initData();
simpanData();
reset_mc._visible = false;
};
reset_mc.no_btn.onRelease = function () {
reset_mc._visible = false;
};
};
bar1_mc.bar_mc._x = Math.ceil((_root.volume1 / 0.434782608695652) - 115);
bar1_mc.bar_mc.onEnterFrame = function () {
_root.volume1 = int(0.434782608695652 * (this._x + 115));
_root.myMusic.setVolume(_root.volume1);
bar1_mc.persen1 = _root.volume1 + " %";
};
bar1_mc.indi_mc.onPress = function () {
klik();
startDrag (bar1_mc.bar_mc, true, -115, 0, 115, 0);
};
bar1_mc.indi_mc.onRelease = (bar1_mc.indi_mc.onReleaseOutside = function () {
over();
stopDrag();
});
bar2_mc.bar_mc._x = Math.ceil((_root.volume2 / 0.434782608695652) - 115);
bar2_mc.bar_mc.onEnterFrame = function () {
_root.volume2 = int(0.434782608695652 * (this._x + 115));
_root.volum3 = int(0.434782608695652 * (this._x + 115));
_root.mySound.setVolume(_root.volume2);
_root.mySound2.setVolume(_root.volum3);
bar2_mc.persen2 = _root.volume2 + " %";
};
bar2_mc.indi_mc.onPress = function () {
klik();
startDrag (bar2_mc.bar_mc, true, -115, 0, 115, 0);
};
bar2_mc.indi_mc.onRelease = (bar2_mc.indi_mc.onReleaseOutside = function () {
over();
stopDrag();
});
cekSpeedQuality();
Frame 207
stop();
quit_btn.onRelease = function () {
gotoAndStop (205);
};
Frame 208
stop();
quit_btn.onRelease = function () {
gotoAndStop (205);
};
next_btn.onRelease = function () {
nextFrame();
gotoAndStop;
};
Frame 209
stop();
start_btn.onRelease = function () {
gotoAndStop (211);
};
prev_btn.onRelease = function () {
prevFrame();
gotoAndStop;
};
Frame 210
function cekBack() {
i = 1;
while (i <= 6) {
_root["back" + i].gotoAndStop(1);
_root["back" + i].onRelease = klikBack;
i++;
}
_root["back" + pilihMap].gotoAndStop(2);
}
function klikBack() {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
pilihMap = indi;
cekBack();
}
stop();
pilihMap = 1;
cekBack();
play_btn.onRelease = function () {
gotoAndStop (208);
};
Frame 211
function pilihMapping() {
if (pilihMap == 1) {
mapping = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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
}
function init() {
dalamKotak = 100;
bykMusuh = 1000;
bykPeluru = 1500;
bykEfek = 1800;
posMuncul = 0;
ambilTower = 0;
bykGold = 500 + (pilihMap * 100);
bykWave = 1;
bykTanda = 800;
liveKini = 40 + (pilihMap * 10);
liveMax = liveKini;
sedangUpgrade = false;
cekPause = false;
basicHarga = new Array("", 100, 125, 150, 175, 200);
basicDamage = new Array("", 1.25, 1.5, 1.75, 2, 2.25);
basicRange = new Array("", 50, 50, 50, 50, 50);
basicTembak = new Array("", 10, 10, 10, 10, 10);
basicPeluru = new Array("", 10, 10, 10, 10, 10);
nilaiMusuh = new Array("", 10, 11, 12, 13, 14, 15, 16);
sedangDrag = false;
sudahSelesai = false;
arrayMusuh = new Array();
awalMunculI = new Array();
awalMunculJ = new Array();
ui_mc.start_btn.enabled = true;
cekKeluarMusuh();
cekSpeed();
}
function cekSpeed() {
i = 1;
while (i <= 4) {
ui_mc["speed" + i].gotoAndStop(1);
ui_mc["speed" + i].onRelease = klikSpeed;
i++;
}
ui_mc["speed" + gameSpeed].gotoAndStop(2);
}
function klikSpeed() {
myStr = new String(this);
indi = Number(myStr.substr(myStr.length - 1, 1));
gameSpeed = indi;
cekSpeed();
}
function cekKeluarMusuh() {
if (pilihMap <= 4) {
jumlahMusuh = bykWave * 2;
} else if (pilihMap <= 5) {
jumlahMusuh = bykWave * 3;
} else if (pilihMap <= 6) {
jumlahMusuh = bykWave * 4;
}
musuhKini = jumlahMusuh;
speedMusuh = 3 + (0.1 * bykWave);
if (bykWave <= 10) {
nyawaMusuh = 2.5 + (10 * bykWave);
} else if (bykWave <= 15) {
nyawaMusuh = 2.5 + (15 * bykWave);
} else if (bykWave <= 20) {
nyawaMusuh = 2.5 + (20 * bykWave);
} else {
nyawaMusuh = 2.5 + (25 * bykWave);
}
delayMusuh = 1200 - (bykWave * 5);
delayMusuh = delayMusuh - (gameSpeed * 200);
if (speedMusuh >= 10) {
speedMusuh = 10;
}
if (delayMusuh <= 200) {
delayMusuh = 200;
}
}
function lanjutKe() {
i = 1;
while (i <= 5) {
ui_mc["tower" + i].onRelease = klikTower;
ui_mc["tower" + i].onRollOver = overTower;
ui_mc["tower" + i].onRollOut = outTower;
i++;
}
frame = attachMovie("frame_mc", "frame_mc", 5000);
frame._visible = false;
frame._x = -500;
frame._y = -500;
}
function klikTower() {
if (cekPause == false) {
if (sudahSelesai == false) {
if (sedangDrag == true) {
sedangDrag = false;
removeMovieClip(towerAmbil);
stopDrag();
} else {
myStr = new String(this);
indi = Number(myStr.substr(myStr.length - 1, 1));
if (bykGold >= basicHarga[indi]) {
towerAmbil = attachMovie("tower_mc" + indi, "towerAmbil", 3000);
ambilTower = indi;
towerAmbil._x = -500;
towerAmbil._y = -500;
startDrag (towerAmbil, true);
sedangDrag = true;
}
}
}
}
}
function overTower() {
if (sudahSelesai == false) {
myStr = new String(this);
indi = Number(myStr.substr(myStr.length - 1, 1));
frame._visible = true;
frame.xCost = basicHarga[indi];
indiString = basicDamage[indi];
bykKarakter = new String(indiString);
if (bykKarakter.length >= 10) {
frame.xPower = bykKarakter.substr(0, 9);
} else {
frame.xPower = indiString;
}
frame.gotoAndStop(1);
frame.xRange = basicRange[indi];
frame.xDelay = basicTembak[indi];
frame.xSpeed = basicPeluru[indi];
}
}
function outTower() {
frame._visible = false;
frame._x = -500;
frame._y = -500;
}
function buatMap() {
i = 0;
while (i <= 20) {
j = 0;
while (j <= 13) {
if (i <= 9) {
xi = "0" + i;
} else {
xi = i;
}
if (j <= 9) {
xj = "0" + j;
} else {
xj = j;
}
if (mapping[j][i] == 1) {
kotak = attachMovie("tembok_mc", ("kotak_mc" + xi) + xj, dalamKotak);
kotak._x = (i * 30) + 35;
kotak._y = (j * 30) + 80;
kotak.bisa = true;
kotak.level1 = 1;
kotak.level2 = 1;
kotak.level3 = 1;
kotak.onRelease = klikKotak;
kotak.onRollOver = overKotak;
kotak.onRollOut = outKotak;
dalamKotak++;
} else if (((mapping[j][i] == 0) || (mapping[j][i] == 2)) || (mapping[j][i] == 3)) {
kotak = attachMovie("tembok_mc", ("kotak_mc" + xi) + xj, dalamKotak);
if (mapping[j][i] == 2) {
tanda = attachMovie("tanda_mc", "tanda_mc" + bykTanda, bykTanda);
tanda._x = (i * 30) + 35;
tanda._y = (j * 30) + 80;
tanda.gotoAndStop(1);
bykTanda++;
} else if (mapping[j][i] == 3) {
tanda = attachMovie("tanda_mc", "tanda_mc" + bykTanda, bykTanda);
tanda._x = (i * 30) + 35;
tanda._y = (j * 30) + 80;
tanda.gotoAndStop(2);
bykTanda++;
}
kotak._x = (i * 30) + 35;
kotak._y = (j * 30) + 80;
kotak.bisa = false;
kotak._visible = false;
dalamKotak++;
if (mapping[j][i] == 2) {
awalMunculI[posMuncul] = xi;
awalMunculJ[posMuncul] = xj;
posMuncul++;
}
}
j++;
}
i++;
}
}
function cekAtributeTower(indi, indi2, indi3) {
indi.delayTembak = basicTembak[indi2];
indi.delayMax = indi.delayTembak;
indi.range = basicRange[indi2] + ((10 * indi.level1) - 1);
if (indi3 == "awal") {
indi.bykDamage = 1;
}
}
function overKotak() {
if (sudahSelesai == false) {
if (this._currentframe >= 2) {
if (sedangUpgrade == false) {
frame.gotoAndStop(2);
frame._visible = true;
frame.xCost = basicHarga[this._currentframe - 1];
indiString = (basicDamage[this._currentframe - 1] + "*") + (this.bykDamage + this.level3);
bykKarakter = new String(indiString);
if (bykKarakter.length >= 10) {
frame.xPower = bykKarakter.substr(0, 9);
} else {
frame.xPower = indiString;
}
frame.xRange = basicRange[this._currentframe - 1] + (10 * (this.level1 - 1));
frame.xDelay = basicTembak[this._currentframe - 1];
frame.xSpeed = (basicPeluru[this._currentframe - 1] + (this.level2 / 4)) + gameSpeed;
if (this.level1 >= this.level2) {
if (this.level1 >= this.level3) {
frame.xlevel = "Level " + this.level1;
}
}
if (this.level2 >= this.level1) {
if (this.level2 >= this.level3) {
frame.xlevel = "Level " + this.level2;
}
}
if (this.level3 >= this.level1) {
if (this.level3 >= this.level1) {
frame.xlevel = "Level " + this.level3;
}
}
}
}
}
}
function outKotak() {
frame._visible = false;
frame._x = -500;
frame._y = -500;
}
function klikKotak() {
if (cekPause == false) {
if (sudahSelesai == false) {
if (sedangDrag == true) {
if (this._currentframe == 1) {
bykGold = bykGold - basicHarga[ambilTower];
this.gotoAndStop(ambilTower + 1);
this.tipeTembak = 1;
this.jenisPeluru = ambilTower;
this.jenisTower = 1;
cekAtributeTower(this, ambilTower, "awal");
this.xtarget = undefined;
cekDamage(this);
this.onEnterFrame = enterTower;
sedangDrag = false;
stopDrag();
removeMovieClip(towerAmbil);
}
} else if (this._currentframe >= 2) {
sedangUpgrade = true;
towerAmbil = this;
upgrade = attachMovie("upgrade_mc", "upgrade_mc", 65000);
upgrade._x = 320;
upgrade._y = 240;
upgrade.xlevel1 = "Level " + towerAmbil.level1;
upgrade.xlevel2 = "Level " + towerAmbil.level2;
upgrade.xlevel3 = "Level " + towerAmbil.level3;
upgrade.costUpgrade = Math.ceil(basicHarga[towerAmbil.jenisPeluru] / 4);
upgrade.upgradeCost = ("All Upgrade Cost " + upgrade.costUpgrade) + " Gold";
upgrade.up1_btn.onRelease = function () {
if (bykGold >= upgrade.costUpgrade) {
bykGold = bykGold - upgrade.costUpgrade;
towerAmbil.level1++;
cekAtributeTower(towerAmbil, towerAmbil.jenisPeluru);
upgrade.xlevel1 = "Level " + towerAmbil.level1;
}
};
upgrade.up2_btn.onRelease = function () {
if (bykGold >= upgrade.costUpgrade) {
bykGold = bykGold - upgrade.costUpgrade;
towerAmbil.level2++;
cekAtributeTower(towerAmbil, towerAmbil.jenisPeluru);
upgrade.xlevel2 = "Level " + towerAmbil.level2;
}
};
upgrade.up3_btn.onRelease = function () {
if (bykGold >= upgrade.costUpgrade) {
bykGold = bykGold - upgrade.costUpgrade;
towerAmbil.level3++;
cekAtributeTower(towerAmbil, towerAmbil.jenisPeluru);
upgrade.xlevel3 = "Level " + towerAmbil.level3;
}
};
upgrade.quit_btn.onRelease = function () {
sedangUpgrade = false;
removeMovieClip(upgrade_mc);
};
upgrade.sell_btn.onRelease = function () {
bykGold = bykGold + Math.ceil(basicHarga[towerAmbil.jenisPeluru] / 1.5);
sedangUpgrade = false;
towerAmbil.gotoAndStop(1);
delete towerAmbil.onEnterFrame;
removeMovieClip(upgrade_mc);
};
}
}
}
}
function enterTower() {
if (cekPause == false) {
this.xtarget = undefined;
i = 0;
while (i <= (arrayMusuh.length - 1)) {
if (_root["musuh_mc" + arrayMusuh[i]] != undefined) {
this.jarak = Math.sqrt(Math.pow(_root["musuh_mc" + arrayMusuh[i]]._x - this._x, 2) + Math.pow(_root["musuh_mc" + arrayMusuh[i]]._y - this._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root["musuh_mc" + arrayMusuh[i]];
this.delayTembak = this.delayTembak + gameSpeed;
i = arrayMusuh.length - 1;
}
}
i++;
}
if (this.xtarget != undefined) {
if (this.delayTembak >= this.delayMax) {
this.jarak = Math.sqrt(Math.pow(this.xtarget._x - this._x, 2) + Math.pow(this.xtarget._y - this._y, 2));
if (this.jarak <= this.range) {
this.delayTembak = 0;
peluru = attachMovie("peluru_mc" + this.jenisPeluru, "peluru_mc" + bykPeluru, bykPeluru);
peluru._x = this._x;
peluru._y = this._y;
peluru.speed = (basicPeluru[this.jenisPeluru] + (this.level2 / 4)) + gameSpeed;
peluru.aimX = this.xtarget._x;
peluru.aimY = this.xtarget._y;
peluru.xtarget = this.xtarget;
peluru.jenisPeluru = this.jenisPeluru;
peluru.damage = basicDamage[this.jenisPeluru] * (this.bykDamage + this.level3);
peluru.deltaX = peluru._x - peluru.aimX;
peluru.deltaY = peluru._y - peluru.aimY;
peluru.xangle = (-Math.atan2(peluru.deltaX, peluru.deltaY)) / (Math.PI/180);
peluru.onEnterFrame = enterPeluru;
bykPeluru++;
if (bykPeluru >= 1600) {
bykPeluru = 1500;
}
}
}
}
}
}
function cekDamage(indi) {
if (cekPause == false) {
if (indi._currentframe >= 2) {
myStr = new String(indi);
indiI = Number(myStr.substr(myStr.length - 4, 2));
indiJ = Number(myStr.substr(myStr.length - 2, 2));
xindiI = myStr.substr(myStr.length - 4, 2);
xindiJ = myStr.substr(myStr.length - 2, 2);
arahKanan = Number(indiI) + 1;
arahKiri = Number(indiI) - 1;
arahAtas = Number(indiJ) - 1;
arahBawah = Number(indiJ) + 1;
cekWarnaKini = indi._currentframe - 1;
warna1 = false;
warna2 = false;
warna3 = false;
warna4 = false;
warna5 = false;
cekPengalian = basicDamage[cekWarnaKini];
if (arahKanan <= 9) {
xarahKanan = "0" + arahKanan;
} else {
xarahKanan = arahKanan;
}
if (arahKiri <= 9) {
xarahKiri = "0" + arahKiri;
} else {
xarahKiri = arahKiri;
}
if (arahAtas <= 9) {
xarahAtas = "0" + arahAtas;
} else {
xarahAtas = arahAtas;
}
if (arahBawah <= 9) {
xarahBawah = "0" + arahBawah;
} else {
xarahBawah = arahBawah;
}
i = 1;
while (i <= 5) {
if (_root[("kotak_mc" + xarahKanan) + xindiJ]._currentframe == (i + 1)) {
unitKanan = _root[("kotak_mc" + xarahKanan) + xindiJ];
if ((_root[("kotak_mc" + xarahKanan) + xindiJ]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
if (_root[("kotak_mc" + xarahKiri) + xindiJ]._currentframe == (i + 1)) {
unitKiri = _root[("kotak_mc" + xarahKiri) + xindiJ];
if ((_root[("kotak_mc" + xarahKiri) + xindiJ]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
if (_root[("kotak_mc" + xindiI) + xarahAtas]._currentframe == (i + 1)) {
unitAtas = _root[("kotak_mc" + xindiI) + xarahAtas];
if ((_root[("kotak_mc" + xindiI) + xarahAtas]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
if (_root[("kotak_mc" + xindiI) + xarahBawah]._currentframe == (i + 1)) {
unitBawah = _root[("kotak_mc" + xindiI) + xarahBawah];
if ((_root[("kotak_mc" + xindiI) + xarahBawah]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
i++;
}
adaPengalian = false;
i = 1;
while (i <= 5) {
if (_root["warna" + i] == true) {
cekPengalian = cekPengalian * basicDamage[i];
adaPengalian = true;
}
i++;
}
if (adaPengalian == false) {
cekPengalian = 1;
}
indi.bykDamage = cekPengalian;
cekDamage2(unitKanan);
cekDamage2(unitKiri);
cekDamage2(unitAtas);
cekDamage2(unitBawah);
}
}
}
function cekDamage2(indi) {
if (cekPause == false) {
if (indi._currentframe >= 2) {
myStr = new String(indi);
indiI = Number(myStr.substr(myStr.length - 4, 2));
indiJ = Number(myStr.substr(myStr.length - 2, 2));
xindiI = myStr.substr(myStr.length - 4, 2);
xindiJ = myStr.substr(myStr.length - 2, 2);
arahKanan = Number(indiI) + 1;
arahKiri = Number(indiI) - 1;
arahAtas = Number(indiJ) - 1;
arahBawah = Number(indiJ) + 1;
cekWarnaKini = indi._currentframe - 1;
warna1 = false;
warna2 = false;
warna3 = false;
warna4 = false;
warna5 = false;
cekPengalian = basicDamage[cekWarnaKini];
if (arahKanan <= 9) {
xarahKanan = "0" + arahKanan;
} else {
xarahKanan = arahKanan;
}
if (arahKiri <= 9) {
xarahKiri = "0" + arahKiri;
} else {
xarahKiri = arahKiri;
}
if (arahAtas <= 9) {
xarahAtas = "0" + arahAtas;
} else {
xarahAtas = arahAtas;
}
if (arahBawah <= 9) {
xarahBawah = "0" + arahBawah;
} else {
xarahBawah = arahBawah;
}
i = 1;
while (i <= 5) {
if (_root[("kotak_mc" + xarahKanan) + xindiJ]._currentframe == (i + 1)) {
if ((_root[("kotak_mc" + xarahKanan) + xindiJ]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
if (_root[("kotak_mc" + xarahKiri) + xindiJ]._currentframe == (i + 1)) {
if ((_root[("kotak_mc" + xarahKiri) + xindiJ]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
if (_root[("kotak_mc" + xindiI) + xarahAtas]._currentframe == (i + 1)) {
if ((_root[("kotak_mc" + xindiI) + xarahAtas]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
if (_root[("kotak_mc" + xindiI) + xarahBawah]._currentframe == (i + 1)) {
if ((_root[("kotak_mc" + xindiI) + xarahBawah]._currentframe - 1) != cekWarnaKini) {
_root["warna" + i] = true;
}
}
i++;
}
adaPengalian = false;
i = 1;
while (i <= 5) {
if (_root["warna" + i] == true) {
cekPengalian = cekPengalian * basicDamage[i];
adaPengalian = true;
}
i++;
}
if (adaPengalian == false) {
cekPengalian = 1;
}
indi.bykDamage = cekPengalian;
}
}
}
function enterPeluru() {
if (cekPause == false) {
this.deltaX = this._x - this.aimX;
this.deltaY = this._y - this.aimY;
this.angle = (-Math.atan2(this.deltaX, this.deltaY)) / (Math.PI/180);
if (Math.sqrt((this.deltaX * this.deltaX) + (this.deltaY * this.deltaY)) > this.speed) {
this._y = this._y - (this.speed * Math.cos(this.xangle * (Math.PI/180)));
this._x = this._x + (this.speed * Math.sin(this.xangle * (Math.PI/180)));
} else {
if (this.xtarget != undefined) {
this.gotoAndStop(2);
if (this.hitTest(this.xtarget)) {
this.xtarget.nyawa = this.xtarget.nyawa - this.damage;
cekEfek(this.xtarget, this.jenisPeluru);
if (this.xtarget.nyawa <= 0) {
if (this.xtarget._currentframe != 2) {
score++;
cekTambahGold(this.xtarget);
cekMatiMusuh();
}
this.xtarget.gotoAndStop(2);
arrayMusuh.splice(this.xtarget.keMusuh, 1);
}
}
}
removeMovieClip(this);
}
if ((((this._x <= 0) || (this._y <= 0)) || (this._x >= 640)) || (this._y >= 480)) {
removeMovieClip(this);
}
}
}
function cekTambahGold(indi) {
if (pilihMap <= 4) {
if (indi.tipeMusuh == 7) {
bykGold = bykGold + int(((1 + (pilihMap / 6)) * indi.jenisMusuh) * 2);
} else {
bykGold = bykGold + int((1 + (pilihMap / 6)) * indi.jenisMusuh);
}
} else if (pilihMap <= 5) {
if (indi.tipeMusuh == 7) {
bykGold = bykGold + int(((1 + (pilihMap / 4.5)) * indi.jenisMusuh) * 2);
} else {
bykGold = bykGold + int((1 + (pilihMap / 4.5)) * indi.jenisMusuh);
}
} else if (pilihMap <= 6) {
if (indi.tipeMusuh == 7) {
bykGold = bykGold + int(((1 + (pilihMap / 3)) * indi.jenisMusuh) * 2);
} else {
bykGold = bykGold + int((1 + (pilihMap / 3)) * indi.jenisMusuh);
}
}
}
function cekMatiMusuh() {
if (cekPause == false) {
musuhKini--;
if (musuhKini <= 0) {
clearInterval(idMusuh);
bykWave++;
cekKeluarMusuh();
ui_mc.start_btn.enabled = true;
}
}
}
function cekEfek(indi, indi2) {
jenisEfek = indi2;
efek = attachMovie("efek" + jenisEfek, "efek_mc" + bykEfek, bykEfek);
efek._x = indi._x;
efek._y = indi._y;
efek._xscale = (efek._yscale = 75);
bykEfek++;
if (bykEfek >= 1900) {
bykEfek = 1800;
}
}
function munculMusuh() {
if (cekPause == false) {
if (jumlahMusuh > 0) {
if (bykWave >= 20) {
randSulit = random(10);
} else {
randSulit = 0;
}
if (randSulit == 1) {
jenisMusuh = 7;
} else {
jenisMusuh = random(pilihMap) + 1;
}
i = 0;
while (i <= (posMuncul - 1)) {
musuh = attachMovie("musuh_mc" + jenisMusuh, "musuh_mc" + bykMusuh, bykMusuh);
musuh._x = _root[("kotak_mc" + awalMunculI[i]) + awalMunculJ[i]]._x;
musuh._y = _root[("kotak_mc" + awalMunculI[i]) + awalMunculJ[i]]._y;
if (jenisMusuh == 7) {
musuh.speed = speedMusuh - 0.4;
} else {
musuh.speed = speedMusuh - (jenisMusuh / 2.5);
}
if (musuh.speed <= 0.5) {
musuh.speed = 0.5;
}
if (jenisMusuh == 7) {
musuh.nyawa = nyawaMusuh * 2;
} else {
musuh.nyawa = nyawaMusuh + jenisMusuh;
}
musuh.jenisMusuh = nilaiMusuh[jenisMusuh];
musuh.tipeMusuh = jenisMusuh;
musuh.keMusuh = bykMusuh;
musuh.arah = "";
musuh.posKiniI = awalMunculI[i];
musuh.posKiniJ = awalMunculJ[i];
cekArah2(musuh.posKiniI, musuh.posKiniJ, musuh);
musuh.onEnterFrame = enterMusuh;
arrayMusuh.push(bykMusuh);
bykMusuh++;
if (bykMusuh >= 1400) {
bykMusuh = 1000;
}
jumlahMusuh--;
i++;
}
} else {
clearInterval(idMusuh);
}
}
}
function enterMusuh() {
if (cekPause == false) {
if (this.arah == "kanan") {
this._x = this._x + (this.speed * gameSpeed);
if (this.posLanjutJ <= 9) {
this.xposLanjutJ = "0" + this.posLanjutJ;
} else {
this.xposLanjutJ = this.posLanjutJ;
}
if (this.posLanjutI <= 9) {
this.xposLanjutI = "0" + this.posLanjutI;
} else {
this.xposLanjutI = this.posLanjutI;
}
if (this._x >= _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._x) {
this._x = _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._x;
this.posKiniI = this.xposLanjutI;
this.posKiniJ = this.xposLanjutJ;
cekArah(this.posKiniI, this.posKiniJ, this);
}
} else if (this.arah == "kiri") {
this._x = this._x - (this.speed * gameSpeed);
if (this.posLanjutJ <= 9) {
this.xposLanjutJ = "0" + this.posLanjutJ;
} else {
this.xposLanjutJ = this.posLanjutJ;
}
if (this.posLanjutI <= 9) {
this.xposLanjutI = "0" + this.posLanjutI;
} else {
this.xposLanjutI = this.posLanjutI;
}
if (this._x <= _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._x) {
this._x = _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._x;
this.posKiniI = this.xposLanjutI;
this.posKiniJ = this.xposLanjutJ;
cekArah(this.posKiniI, this.posKiniJ, this);
}
} else if (this.arah == "bawah") {
this._y = this._y + (this.speed * gameSpeed);
if (this.posLanjutJ <= 9) {
this.xposLanjutJ = "0" + this.posLanjutJ;
} else {
this.xposLanjutJ = this.posLanjutJ;
}
if (this.posLanjutI <= 9) {
this.xposLanjutI = "0" + this.posLanjutI;
} else {
this.xposLanjutI = this.posLanjutI;
}
if (this._y >= _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._y) {
this._y = _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._y;
this.posKiniI = this.xposLanjutI;
this.posKiniJ = this.xposLanjutJ;
cekArah(this.posKiniI, this.posKiniJ, this);
}
} else if (this.arah == "atas") {
this._y = this._y - (this.speed * gameSpeed);
if (this.posLanjutJ <= 9) {
this.xposLanjutJ = "0" + this.posLanjutJ;
} else {
this.xposLanjutJ = this.posLanjutJ;
}
if (this.posLanjutI <= 9) {
this.xposLanjutI = "0" + this.posLanjutI;
} else {
this.xposLanjutI = this.posLanjutI;
}
if (this._y <= _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._y) {
this._y = _root[("kotak_mc" + this.xposLanjutI) + this.xposLanjutJ]._y;
this.posKiniI = this.xposLanjutI;
this.posKiniJ = this.xposLanjutJ;
cekArah(this.posKiniI, this.posKiniJ, this);
}
}
}
}
function cekArah2(indiI, indiJ, indi) {
arahKanan = Number(indiI) + 1;
arahKiri = Number(indiI) - 1;
arahAtas = Number(indiJ) - 1;
arahBawah = Number(indiJ) + 1;
indiI = Number(indiI);
indiJ = Number(indiJ);
if ((mapping[indiJ][arahKanan] == 0) && (indi.arah != "kiri")) {
indi.arah = "kanan";
indi.posLanjutJ = indiJ;
indi.posLanjutI = arahKanan;
indi._rotation = 0;
sudahLanjut = 1;
} else if ((mapping[indiJ][arahKiri] == 0) && (indi.arah != "kanan")) {
indi.arah = "kiri";
indi.posLanjutJ = indiJ;
indi.posLanjutI = arahKiri;
indi._rotation = 180;
sudahLanjut = 1;
} else if ((mapping[arahBawah][indiI] == 0) && (indi.arah != "atas")) {
indi.arah = "bawah";
indi.posLanjutJ = arahBawah;
indi.posLanjutI = indiI;
indi._rotation = 90;
sudahLanjut = 1;
} else if ((mapping[arahAtas][indiI] == 0) && (indi.arah != "bawah")) {
indi.arah = "atas";
indi.posLanjutJ = arahAtas;
indi.posLanjutI = indiI;
indi._rotation = 270;
sudahLanjut = 1;
}
}
function cekArah(indiI, indiJ, indi) {
arahKanan = Number(indiI) + 1;
arahKiri = Number(indiI) - 1;
arahAtas = Number(indiJ) - 1;
arahBawah = Number(indiJ) + 1;
indiI = Number(indiI);
indiJ = Number(indiJ);
sudahLanjut = 0;
if (sudahLanjut == 0) {
if ((mapping[indiJ][arahKanan] != 1) && (indi.arah != "kiri")) {
if ((mapping[arahBawah][indiI] == 1) || (mapping[arahAtas][indiI] == 1)) {
indi.arah = "kanan";
indi.posLanjutJ = indiJ;
indi.posLanjutI = arahKanan;
indi._rotation = 0;
sudahLanjut = 1;
}
}
}
if (sudahLanjut == 0) {
if ((mapping[indiJ][arahKiri] != 1) && (indi.arah != "kanan")) {
if ((mapping[arahBawah][indiI] == 1) || (mapping[arahAtas][indiI] == 1)) {
indi.arah = "kiri";
indi.posLanjutJ = indiJ;
indi.posLanjutI = arahKiri;
indi._rotation = 180;
sudahLanjut = 1;
}
}
}
if (sudahLanjut == 0) {
if ((mapping[arahBawah][indiI] != 1) && (indi.arah != "atas")) {
if ((mapping[indiJ][arahKanan] == 1) || (mapping[indiJ][arahKiri] == 1)) {
indi.arah = "bawah";
indi.posLanjutJ = arahBawah;
indi.posLanjutI = indiI;
indi._rotation = 90;
sudahLanjut = 1;
}
}
}
if (sudahLanjut == 0) {
if ((mapping[arahAtas][indiI] != 1) && (indi.arah != "bawah")) {
if ((mapping[indiJ][arahKanan] == 1) || (mapping[indiJ][arahKiri] == 1)) {
indi.arah = "atas";
indi.posLanjutJ = arahAtas;
indi.posLanjutI = indiI;
indi._rotation = 270;
sudahLanjut = 1;
}
}
}
if (sudahLanjut == 0) {
if (indi.arah == "kanan") {
indi.posLanjutJ = indiJ;
indi.posLanjutI = arahKanan;
indi._rotation = 0;
sudahLanjut = 1;
} else if (indi.arah == "kiri") {
indi.posLanjutJ = indiJ;
indi.posLanjutI = arahKiri;
indi._rotation = 180;
sudahLanjut = 1;
} else if (indi.arah == "bawah") {
indi.posLanjutJ = arahBawah;
indi.posLanjutI = indiI;
indi._rotation = 90;
sudahLanjut = 1;
} else if (indi.arah == "atas") {
indi.posLanjutJ = arahAtas;
indi.posLanjutI = indiI;
indi._rotation = 270;
sudahLanjut = 1;
}
}
if ((mapping[indiJ][indiI] == 2) || (mapping[indiJ][indiI] == 3)) {
cekTambahGold(indi);
cekMatiMusuh();
liveKini--;
if (liveKini <= 0) {
if (sudahSelesai == false) {
sudahSelesai = true;
idSelesai = setInterval(cekSelesai, 1000);
}
}
arrayMusuh.splice(indi.keMusuh, 1);
removeMovieClip(indi);
}
}
function clearSemua() {
removeMovieClip(frame);
removeMovieClip(towerAmbil);
i = 0;
while (i <= 20) {
j = 0;
while (j <= 13) {
if (i <= 9) {
xi = "0" + i;
} else {
xi = i;
}
if (j <= 9) {
xj = "0" + j;
} else {
xj = j;
}
removeMovieClip(_root[("kotak_mc" + xi) + xj]);
j++;
}
i++;
}
removeMovieClip(upgrade_mc);
i = 1500;
while (i <= 1600) {
removeMovieClip(_root["peluru_mc" + i]);
i++;
}
i = 1800;
while (i <= 1900) {
removeMovieClip(_root["efek_mc" + i]);
i++;
}
i = 1000;
while (i <= 1400) {
removeMovieClip(_root["musuh_mc" + i]);
i++;
}
i = 800;
while (i <= 810) {
removeMovieClip(_root["tanda_mc" + i]);
i++;
}
removeMovieClip(selesai_mc);
removeMovieClip(option_mc);
clearInterval(idSelesai);
clearInterval(idMusuh);
}
function cekSelesai() {
clearInterval(idSelesai);
clearInterval(idMusuh);
if (jenisMain == "arcade") {
selesai = attachMovie("selesai_mc", "selesai_mc", 65001);
selesai._x = 320;
selesai._y = 240;
selesai.continue_btn.onRelease = function () {
clearSemua();
pilihMap++;
if (pilihMap >= 7) {
gotoAndStop (214);
} else {
init();
pilihMapping();
buatMap();
lanjutKe();
simpanData();
}
};
} else {
selesai = attachMovie("selesai_mc", "selesai_mc", 65001);
selesai.gotoAndStop(2);
selesai._x = 320;
selesai._y = 240;
selesai.continue_btn.onRelease = function () {
clearSemua();
gotoAndStop (205);
};
}
}
stop();
gameSpeed = 1;
backMusic();
_quality = "LOW";
init();
pilihMapping();
buatMap();
ui_mc.start_btn.onRelease = function () {
if (sudahSelesai == false) {
this.enabled = false;
arrayMusuh = new Array();
cekKeluarMusuh();
idMusuh = setInterval(munculMusuh, delayMusuh);
}
};
ui_mc.options_btn.onRelease = function () {
cekPause = true;
option = attachMovie("option_mc", "option_mc", 5009);
option._x = 320;
option._y = 240;
option.keluar_btn.onRelease = function () {
clearSemua();
gotoAndStop (205);
};
option.quit_btn.onRelease = function () {
cekPause = false;
removeMovieClip(option);
};
};
lanjutKe();
_root.onEnterFrame = function () {
if (frame._visible == true) {
if (_root._xmouse <= 200) {
frame._x = _root._xmouse + 100;
} else if (_root._xmouse >= 440) {
frame._x = _root._xmouse - 100;
} else {
frame._x = _root._xmouse;
}
if (_root._ymouse <= 240) {
frame._y = _root._ymouse + 100;
} else {
frame._y = _root._ymouse - 100;
}
}
ui_mc.xLive = (liveKini + "/") + liveMax;
ui_mc.xGold = bykGold;
ui_mc.xWave = bykWave;
ui_mc.xEnemy = musuhKini;
ui_mc.xScore = score;
ui_mc.xMap = pilihMap;
};
Frame 213
stop();
backMusic2();
quit_btn.onRelease = function () {
gotoAndStop (205);
};
if (xscore <= 0) {
xscore = 0;
}
playerScore = xscore;
nama_txt.text = "Glow Player";
submit_btn.onRelease = function () {
this.enabled = false;
playerName = nama_txt.text;
getURL (((("http://www.belugerinstudios.com/action.php?act=submitscore&game=FL102202021&name=" + playerName) + "&score=") + playerScore) + "&key=", "_blank");
this.enabled = false;
};
Frame 214
stop();
backMusic2();
quit_btn.onRelease = function () {
yangDiSave();
simpanData();
gotoAndStop (205);
};
playerScore = score;
nama_txt.text = "Glow Player";
submit_btn.onRelease = function () {
this.enabled = false;
playerName = nama_txt.text;
playerScore = score;
getURL (((("http://www.belugerinstudios.com/action.php?act=submitscore&game=FL11041587&name=" + playerName) + "&score=") + playerScore) + "&key=", "_blank");
this.enabled = false;
};
Symbol 13 MovieClip Frame 1
stop();
Symbol 93 MovieClip Frame 1
this.onPress = function () {
getURL ("http://www.belugerinstudios.com/", "_blank");
};
Symbol 130 MovieClip [ledakan] Frame 10
removeMovieClip(this._parent);
Symbol 144 MovieClip [musuh_mc1] Frame 1
stop();
Symbol 144 MovieClip [musuh_mc1] Frame 2
_root.backDestroy();
Symbol 147 MovieClip [musuh_mc2] Frame 1
stop();
Symbol 147 MovieClip [musuh_mc2] Frame 2
_root.backDestroy();
Symbol 150 MovieClip [musuh_mc3] Frame 1
stop();
Symbol 150 MovieClip [musuh_mc3] Frame 2
_root.backDestroy();
_root.backDestroy();
Symbol 153 MovieClip [musuh_mc4] Frame 1
stop();
Symbol 153 MovieClip [musuh_mc4] Frame 2
_root.backDestroy2();
Symbol 156 MovieClip [musuh_mc5] Frame 1
stop();
Symbol 156 MovieClip [musuh_mc5] Frame 2
_root.backDestroy2();
Symbol 159 MovieClip [musuh_mc6] Frame 1
stop();
Symbol 159 MovieClip [musuh_mc6] Frame 2
_root.backDestroy2();
_root.backDestroy2();
Symbol 162 MovieClip [musuh_mc7] Frame 1
stop();
Symbol 162 MovieClip [musuh_mc7] Frame 2
_root.backDestroy2();
Symbol 165 MovieClip [peluru_mc1] Frame 1
stop();
Symbol 166 MovieClip [peluru_mc2] Frame 1
stop();
Symbol 167 MovieClip [peluru_mc3] Frame 1
stop();
Symbol 168 MovieClip [peluru_mc4] Frame 1
stop();
Symbol 170 MovieClip [tower_mc1] Frame 1
stop();
Symbol 170 MovieClip [tower_mc1] Frame 3
_root.backDestroy();
Symbol 174 MovieClip [tower_mc2] Frame 1
stop();
Symbol 174 MovieClip [tower_mc2] Frame 3
_root.backDestroy();
Symbol 178 MovieClip [tower_mc3] Frame 1
stop();
Symbol 178 MovieClip [tower_mc3] Frame 3
_root.backDestroy2();
Symbol 182 MovieClip [tower_mc4] Frame 1
stop();
Symbol 182 MovieClip [tower_mc4] Frame 3
_root.backDestroy2();
Symbol 192 MovieClip Frame 1
stop();
Symbol 202 MovieClip Frame 1
this.onPress = function () {
getURL ("http://www.belugerinstudios.com/", "_blank");
};
Symbol 207 MovieClip [tower_mc5] Frame 1
stop();
Symbol 207 MovieClip [tower_mc5] Frame 3
_root.backDestroy2();
Symbol 214 MovieClip Frame 1
stop();
Symbol 232 MovieClip Frame 1
stop();
Symbol 246 MovieClip [option_mc] Frame 1
function cekSpeedQuality() {
i = 1;
while (i <= 3) {
this["speed" + i].angka = i;
this["quality" + i].angka = i;
this["speed" + i].gotoAndStop(1);
this["quality" + i].gotoAndStop(1);
this["speed" + i].onRelease = klikSpeed;
this["quality" + i].onRelease = klikQuality;
this["speed" + i].onRollOver = function () {
over();
};
this["quality" + i].onRollOver = function () {
over();
};
i++;
}
this["speed" + _root.speedGame].gotoAndStop(2);
this["quality" + _root.qualityGame].gotoAndStop(2);
}
function klikSpeed() {
klik();
indi = new String(this);
_root.speedGame = Number(indi.substr(indi.length - 1, 1));
cekSpeedQuality();
}
function klikQuality() {
klik();
indi = new String(this);
_root.qualityGame = Number(indi.substr(indi.length - 1, 1));
if (_root.qualityGame == 1) {
_quality = "HIGH";
} else if (_root.qualityGame == 2) {
_quality = "MEDIUM";
} else if (_root.qualityGame == 3) {
_quality = "LOW";
}
cekSpeedQuality();
}
stop();
bar1_mc.bar_mc._x = Math.ceil((_root.volume1 / 0.434782608695652) - 115);
bar1_mc.bar_mc.onEnterFrame = function () {
_root.volume1 = int(0.434782608695652 * (this._x + 115));
_root.myMusic.setVolume(_root.volume1);
bar1_mc.persen1 = _root.volume1 + " %";
};
bar1_mc.indi_mc.onPress = function () {
klik();
startDrag (bar1_mc.bar_mc, true, -115, 0, 115, 0);
};
bar1_mc.indi_mc.onRelease = (bar1_mc.indi_mc.onReleaseOutside = function () {
over();
stopDrag();
});
bar2_mc.bar_mc._x = Math.ceil((_root.volume2 / 0.434782608695652) - 115);
bar2_mc.bar_mc.onEnterFrame = function () {
_root.volume2 = int(0.434782608695652 * (this._x + 115));
_root.volum3 = int(0.434782608695652 * (this._x + 115));
_root.mySound.setVolume(_root.volume2);
_root.mySound2.setVolume(_root.volum3);
bar2_mc.persen2 = _root.volume2 + " %";
};
bar2_mc.indi_mc.onPress = function () {
klik();
startDrag (bar2_mc.bar_mc, true, -115, 0, 115, 0);
};
bar2_mc.indi_mc.onRelease = (bar2_mc.indi_mc.onReleaseOutside = function () {
over();
stopDrag();
});
cekSpeedQuality();
Symbol 247 MovieClip [tembok_mc] Frame 1
stop();
Symbol 248 MovieClip Frame 10
removeMovieClip(this);
Symbol 249 MovieClip [peluru_mc5] Frame 1
stop();
Symbol 250 MovieClip [efek1] Frame 10
removeMovieClip(this);
Symbol 251 MovieClip [efek2] Frame 10
removeMovieClip(this);
Symbol 252 MovieClip [efek3] Frame 10
removeMovieClip(this);
Symbol 253 MovieClip [efek4] Frame 10
removeMovieClip(this);
Symbol 254 MovieClip [efek5] Frame 10
removeMovieClip(this);
Symbol 270 MovieClip [frame_mc] Frame 1
stop();
Symbol 286 MovieClip [upgrade_mc] Frame 1
stop();
Symbol 293 MovieClip [selesai_mc] Frame 1
stop();
Symbol 293 MovieClip [selesai_mc] Frame 2
stop();
Symbol 298 MovieClip [tanda_mc] Frame 1
stop();
Symbol 312 MovieClip Frame 1
stop();
Symbol 383 MovieClip Frame 175
stop();
Symbol 442 MovieClip Frame 175
stop();
Symbol 451 MovieClip Frame 1
this.onPress = function () {
getURL ("http://www.belugerinstudios.com", "_blank");
};
Symbol 451 MovieClip Frame 185
stop();
Symbol 479 MovieClip Frame 1
stop();
Symbol 524 MovieClip Frame 1
stop();
Symbol 528 MovieClip Frame 1
stop();
Symbol 532 MovieClip Frame 1
stop();
Symbol 536 MovieClip Frame 1
stop();
Symbol 540 MovieClip Frame 1
stop();
Symbol 543 MovieClip Frame 1
stop();
Symbol 550 MovieClip Frame 1
stop();