Frame 1
function preloadSite() {
var _local4 = _root.getBytesLoaded();
var _local3 = _root.getBytesTotal();
var _local2 = Math.round((_local4 / _local3) * 100);
percentage_txt.text = _local2;
loader_mc.gotoAndStop(_local2);
bytesDisplay.text = _local2 + "%";
if (_local4 >= _local3) {
clearInterval(loadingCall);
gotoAndStop ("menu");
}
}
function deadClick() {
getURL ("http://www.cargames9.co.uk", "_blank");
}
function gotoMySite() {
getURL ("http://www.fungames9.com", "_blank");
}
stop();
loadingBar._xscale = 1;
var loadingCall = setInterval(preloadSite, 50);
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var mySiteLink = new ContextMenuItem("More Games", gotoMySite);
var copyrightNotice = new ContextMenuItem("@ www.fungames9.com", gotoMySite);
myMenu.customItems.push(mySiteLink);
myMenu.customItems.push(copyrightNotice);
_root.menu = myMenu;
fscommand ("alloscale", false);
Instance of Symbol 363 MovieClip "fungameslogo" in Frame 1
on (release) {
getURL ("http://www.fungames9.com/", "_blank");
}
Frame 2
function btnVisible() {
play_btn._visible = true;
}
stop();
play_btn._visible = false;
setTimeout(btnVisible, 7000);
play_btn.onRelease = function () {
gotoAndStop ("Preloader");
};
Frame 3
function highScore() {
getURL ("http://www.fungames9.com/gamescore/dragonballs/", "_blank");
}
function moreGames() {
getURL ("http://www.fungames9.com", "_blank");
}
function faceBookBtn() {
getURL ("", "_blank");
}
function menuFunc(number) {
trace("number : - " + number);
switch (number) {
case 1 :
var _local2 = new Sound(this);
_local2.attachSound("startSnd");
_local2.start(0, 1);
level = 1;
gotoAndStop ("Main");
break;
case 2 :
gotoAndStop ("help");
break;
case 3 :
highScore();
break;
case 4 :
moreGames();
break;
case 5 :
gotoAndStop ("levels");
}
}
Mouse.show();
removeMovieClip(Cursor);
_global.gameon = false;
_root.Musiikki = new Sound(_root);
_global.allsound = new Sound(_root);
whoosh = new Sound(this);
whoosh.attachSound("swoosh");
_global.dummy = "Kopd";
if (_global.musiikkia != "Juujuu") {
_root.Musiikki.attachSound("musicBG");
_root.Musiikki.start(0, 999);
_global.musiikkia = "Juujuu";
}
haiskoreteksti = "Submit to highscores";
virhenappi._visible = false;
frosmosplashi._alpha = 0;
aloitusaika = getTimer();
var level = 0;
playerDetails = SharedObject.getLocal("user");
if (playerDetails.data.lev == undefined) {
trace("inside");
playerDetails.data.lev = level;
} else {
trace("defined");
level = playerDetails.data.lev;
}
Frame 4
stop();
Frame 5
stop();
trace("level " + level);
var i = 1;
while (i <= 12) {
eval ("lev" + i).gotoAndStop(1);
eval ("lev" + i).num = i;
i++;
}
var i = 1;
while (i <= (level + 1)) {
eval ("lev" + i).gotoAndStop(2);
eval ("lev" + i).number_txt.text = i;
eval ("lev" + i).onRelease = function () {
trace("this " + this);
level = this.num;
menubg_snd.stop();
_root.gotoAndStop("Main");
};
i++;
}
Frame 6
function levelUpdate() {
trace("mainScore " + mainScore);
_root.onEnterFrame = function () {
trace("nextLevelUpdate " + nextLevelUpdate);
if (nextLevelUpdate) {
trace("entered level update");
nextLevelUpdate = false;
var tempMc = eval ("level" + (level - 1));
tempMc.gotoAndStop(1);
tempMc.onEnterFrame = null;
trace("levelScore " + tempMc.Score);
mc = eval ("level" + level);
var faddInT = (new mx.transitions.Tween(mc, "_x", mx.transitions.easing.Strong.easeOut, 735.1, mc._x - 780, 1, true));
onEnterFrame = false;
mc.gotoAndStop(2);
faddInT.onMotionFinished = function () {
level++;
Mouse.hide();
var _local1 = new mx.transitions.Tween(tempMc, "_x", mx.transitions.easing.Strong.easeIn, tempMc._x, tempMc._x + 780, 0.1, true);
};
}
};
}
function showGameOver() {
setTimeout(one, 500);
}
function showGameCompleted() {
setTimeout(two, 500);
}
function one() {
stopAllSounds();
Mouse.show();
gameend_mc._visible = true;
gameend_mc.gotoAndPlay(2);
}
function two() {
stopAllSounds();
Mouse.show();
gamecompleted_mc._visible = true;
gamecompleted_mc.gotoAndPlay(2);
}
function playAgain() {
level = playerDetails.data.lev;
gotoAndStop ("levels");
grid._visible = false;
}
function submitScore() {
trace("gameend_mc : " + gameend_mc.score);
var _local4 = gameend_mc.name_txt.text;
var _local3 = gameend_mc.score_txt.text;
var _local1 = "";
if (_local3 == "") {
_local1 = _local1 + "The score is required\n";
}
if (_local1 != "") {
status_txt.text = _local1;
return(undefined);
}
var _local2 = new LoadVars();
_local2.name = _local4;
_local2.score = _local3;
_local2.send(path, "_blank", "POST");
gotoAndStop ("menu");
grid._visible = false;
mainScore = 0;
}
stop();
gameend_mc._visible = false;
gamecompleted_mc._visible = false;
var mainScore = 0;
Musiikki.stop();
var mybgSnd = new Sound();
mybgSnd.attachSound("gamebg");
var popSnd = new Sound();
popSnd.attachSound("popSnd");
var nextLevelUpdate = true;
trace("level " + level);
if (level == 0) {
level = 1;
}
levelUpdate();
var mc;
var path = "http://www.fungames9.com/gamescore/dragonballs/submit.php";
Instance of Symbol 138 MovieClip [mute] "Neppula" in Frame 6
onClipEvent (load) {
stop();
}
on (release) {
trace(_global.allsound.getVolume());
if (_global.allsound.getVolume() == 100) {
this.gotoAndStop(2);
_global.allsound.setVolume(0);
} else {
this.gotoAndStop(1);
_global.allsound.setVolume(100);
}
}
on (rollOver) {
Mouse.show();
_root.mc.Cursor._visible = false;
_root.mc.isShooting = false;
}
Frame 7
_global.gameon = false;
Instance of Symbol 138 MovieClip [mute] "Neppula" in Frame 7
onClipEvent (load) {
stop();
}
on (release) {
trace(_global.allsound.getVolume());
if (_global.allsound.getVolume() == 100) {
this.gotoAndStop(2);
_global.allsound.setVolume(0);
} else {
this.gotoAndStop(1);
_global.allsound.setVolume(100);
}
}
Frame 12
gotoAndStop ("Main");
Frame 13
stop();
Mouse.show();
removeMovieClip(Cursor);
Symbol 22 MovieClip [Cursor] Frame 1
stop();
Symbol 22 MovieClip [Cursor] Frame 2
stop();
Symbol 22 MovieClip [Cursor] Frame 3
stop();
Symbol 22 MovieClip [Cursor] Frame 4
stop();
Symbol 22 MovieClip [Cursor] Frame 5
stop();
Symbol 22 MovieClip [Cursor] Frame 6
stop();
Symbol 22 MovieClip [Cursor] Frame 7
stop();
stop();
Symbol 22 MovieClip [Cursor] Frame 8
stop();
Symbol 22 MovieClip [Cursor] Frame 9
stop();
Symbol 22 MovieClip [Cursor] Frame 10
stop();
Symbol 22 MovieClip [Cursor] Frame 11
stop();
Symbol 22 MovieClip [Cursor] Frame 12
stop();
Symbol 22 MovieClip [Cursor] Frame 13
stop();
Symbol 22 MovieClip [Cursor] Frame 14
stop();
Symbol 32 MovieClip [tilepommi] Frame 1
stop();
Symbol 39 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 2
play();
Symbol 39 MovieClip Frame 28
stop();
trace("last");
Symbol 40 MovieClip [file1] Frame 1
stop();
Symbol 42 MovieClip Frame 1
stop();
Symbol 42 MovieClip Frame 2
play();
Symbol 42 MovieClip Frame 28
stop();
Symbol 43 MovieClip [file2] Frame 1
stop();
Symbol 45 MovieClip Frame 1
stop();
Symbol 45 MovieClip Frame 2
play();
Symbol 45 MovieClip Frame 28
stop();
Symbol 46 MovieClip [file3] Frame 1
stop();
Symbol 48 MovieClip Frame 1
stop();
Symbol 48 MovieClip Frame 2
play();
Symbol 48 MovieClip Frame 28
stop();
Symbol 49 MovieClip [file4] Frame 1
stop();
Symbol 51 MovieClip Frame 1
stop();
Symbol 51 MovieClip Frame 2
play();
Symbol 51 MovieClip Frame 28
stop();
Symbol 58 MovieClip Frame 1
stop();
Symbol 58 MovieClip Frame 2
play();
Symbol 58 MovieClip Frame 28
stop();
Symbol 62 MovieClip Frame 1
stop();
Symbol 62 MovieClip Frame 2
play();
Symbol 62 MovieClip Frame 28
stop();
Symbol 72 MovieClip [tilekello] Frame 1
stop();
Symbol 73 MovieClip [kelloefekti] Frame 1
function onEnterFrame() {
if (getTimer() < (_root.kellonalkuaika + _root.kellonkesto)) {
this.kellopalkki._yscale = (((_root.kellonkesto - getTimer()) + _root.kellonalkuaika) / _root.kellonkesto) * 100;
} else {
this.removeMovieClip();
}
}
Symbol 75 MovieClip [Tausta] Frame 1
function onEnterFrame() {
aikakerroin = (getTimer() - edellinenaika) / 33;
edellinenaika = getTimer();
if (this._visible) {
this._alpha = this._alpha - (1 * aikakerroin);
}
if (this._alpha < 0) {
this._visible = false;
}
}
edellinenaika = 0;
stop();
Symbol 112 MovieClip Frame 1
stop();
Symbol 113 MovieClip [tile] Frame 8
stop();
Symbol 113 MovieClip [tile] Frame 16
stop();
Symbol 122 Button
on (release) {
_root.submitScore();
}
Symbol 125 Button
on (press, releaseOutside) {
getURL ("http://www.gamesgeni.com/", "_blank");
}
Symbol 129 MovieClip Frame 1
if (_root.ollaankodeadwhalessa) {
isonappi._visible = false;
}
name_txt.restrict = "a-z A-Z";
Symbol 130 MovieClip [Lopputiski] Frame 1
stop();
Symbol 134 MovieClip [tileydinpommi] Frame 1
stop();
Symbol 363 MovieClip Frame 245
stop();
Symbol 785 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 786 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 787 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 788 MovieClip [__Packages.mx.transitions.easing.Strong] Frame 0
class mx.transitions.easing.Strong
{
function Strong () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return((((((c * t) * t) * t) * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = (t / d) - 1;
return((c * (((((t * t) * t) * t) * t) + 1)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return(((((((c / 2) * t) * t) * t) * t) * t) + b);
}
t = t - 2;
return(((c / 2) * (((((t * t) * t) * t) * t) + 2)) + b);
}
static var version = "1.1.0.52";
}
Symbol 383 Button
on (release) {
gotoAndStop ("menu");
}
Symbol 404 Button
on (release) {
_root.menuFunc(1);
}
Symbol 410 Button
on (release) {
_root.menuFunc(5);
}
Symbol 413 Button
on (release) {
_root.menuFunc(3);
}
Symbol 416 Button
on (release) {
_root.menuFunc(2);
}
Symbol 419 Button
on (release) {
_root.menuFunc(4);
}
Symbol 420 MovieClip Frame 133
stop();
Symbol 425 Button
on (release) {
menuFunc(1);
}
Symbol 532 Button
on (release) {
moreGames();
}
Symbol 561 Button
on (release) {
_root.moreGames();
}
on (rollOver) {
Mouse.show();
Cursor._visible = false;
isShooting = false;
canonRotation = false;
}
Symbol 562 Button
on (release) {
_root.moreGames();
}
on (rollOver) {
Mouse.show();
Cursor._visible = false;
isShooting = false;
canonRotation = false;
}
Symbol 563 Button
on (release) {
if (!GameOver) {
isReset = true;
init();
}
}
on (rollOver) {
Mouse.show();
Cursor._visible = false;
isShooting = false;
canonRotation = false;
}
Symbol 569 Button
on (release) {
_parent.nextLevel();
}
Symbol 570 Button
on (release) {
_parent.moreGames();
}
Instance of Symbol 565 MovieClip in Symbol 575 MovieClip Frame 1
on (rollOver) {
Mouse.show();
this.useHandCursor = false;
}
Symbol 580 MovieClip Frame 1
stop();
Symbol 580 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
_root.mybgSnd.start(0, 999);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 1;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 10;
tuhlailu = 10;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 30) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
trace("removeBlock");
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
trace("bounceCntr " + this.bounceCntr);
if (this.bounceCntr > 5) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
if ((this._x - GridCenterX) < (leftBound + (tileW / 2))) {
this._x = (leftBound + (tileW / 2)) + GridCenterX;
this.xv = Math.abs(this.xv);
this.bounceCntr++;
} else if ((this._x - GridCenterX) > (rightBound - (tileW / 2))) {
this._x = (rightBound - (tileW / 2)) + GridCenterX;
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
} else if (((this._y - GridCenterY) < (upperBound + (tileH / 2))) && (this.eletty > 20)) {
this._y = (upperBound + (tileH / 2)) + GridCenterY;
this.yv = Math.abs(this.yv);
this.bounceCntr++;
} else if ((this._y - GridCenterY) > (lowerBound - (tileH / 2))) {
this._y = (lowerBound - (tileH / 2)) + GridCenterY;
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
var who = 1;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 2;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 1;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 1;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
trace("Number(Score) " + Number(Score));
_root.mainScore = _root.mainScore + Number(Score);
trace("_root.mainScore " + _root.mainScore);
trace("MotionFinished");
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound();
whoosh.attachSound("looseSnd");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 579 MovieClip "terrain" in Symbol 580 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 594 MovieClip Frame 1
stop();
Symbol 594 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 2;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 10;
tuhlailu = 10;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
if (((this.hitTest(line1) || (this.hitTest(line2))) || (this.hitTest(line3))) || (this.hitTest(line4))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var _local2 = new Sound();
_local2.attachSound("looseSnd");
_local2.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 5) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
if ((this._x - GridCenterX) < (leftBound + (tileW / 2))) {
this._x = (leftBound + (tileW / 2)) + GridCenterX;
this.xv = Math.abs(this.xv);
this.bounceCntr++;
} else if ((this._x - GridCenterX) > (rightBound - (tileW / 2))) {
this._x = (rightBound - (tileW / 2)) + GridCenterX;
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
} else if (((this._y - GridCenterY) < (upperBound + (tileH / 2))) && (this.eletty > 20)) {
this._y = (upperBound + (tileH / 2)) + GridCenterY;
this.yv = Math.abs(this.yv);
this.bounceCntr++;
} else if ((this._y - GridCenterY) > (lowerBound - (tileH / 2))) {
this._y = (lowerBound - (tileH / 2)) + GridCenterY;
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var levelEnd = false;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
var tm = 50;
var times = 2;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 3;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 2;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.playerDetails.data.lev = 2;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
Mouse.show();
Cursor.removeMovieClip();
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 593 MovieClip in Symbol 594 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 607 MovieClip Frame 1
stop();
Symbol 607 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 3;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 10;
tuhlailu = 10;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
var i = 1;
while (i <= 45) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 22) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 23;
while (i <= 43) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 12;
while (i <= 33) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 44;
while (i <= 44) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 3;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX + 5;
canon._y = 470;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 3;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.playerDetails.data.lev = 3;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
Mouse.show();
Cursor.removeMovieClip();
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 606 MovieClip in Symbol 607 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 623 MovieClip Frame 1
stop();
Symbol 623 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 4;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 9;
tuhlailu = 9;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 45) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 17) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 26;
while (i <= 41) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 18;
while (i <= 25) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 42;
while (i <= 45) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 3;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 4;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 4;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 622 MovieClip in Symbol 623 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 638 MovieClip Frame 1
stop();
Symbol 638 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 5;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 9;
tuhlailu = 9;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 30) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 1) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 24;
while (i <= 24) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 2;
while (i <= 23) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 25;
while (i <= 25) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 3;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 5;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 5;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 637 MovieClip in Symbol 638 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 652 MovieClip Frame 1
stop();
Symbol 652 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 6;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 9;
tuhlailu = 9;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 30) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 14) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 15;
while (i <= 27) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 28;
while (i <= 28) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 29;
while (i <= 29) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 4;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 6;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 6;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 651 MovieClip in Symbol 652 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 666 MovieClip Frame 1
stop();
Symbol 666 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 7;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 7;
tuhlailu = 7;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 44) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 14) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 28;
while (i <= 41) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 15;
while (i <= 27) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 42;
while (i <= 44) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 4;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 7;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 7;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 665 MovieClip in Symbol 666 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 680 MovieClip Frame 1
stop();
Symbol 680 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 8;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 7;
tuhlailu = 7;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 38) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 18) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 20;
while (i <= 37) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 19;
while (i <= 19) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 38;
while (i <= 38) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 4;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 8;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 8;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 679 MovieClip in Symbol 680 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 694 MovieClip Frame 1
stop();
Symbol 694 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 9;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 7;
tuhlailu = 7;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 51) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 14) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 27;
while (i <= 40) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 15;
while (i <= 26) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 41;
while (i <= 51) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 0;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 4;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 435;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 9;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 9;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 693 MovieClip in Symbol 694 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 708 MovieClip Frame 1
stop();
Symbol 708 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 10;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 8;
tuhlailu = 8;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 51) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 14) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 25;
while (i <= 40) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 15;
while (i <= 24) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 41;
while (i <= 51) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 25;
Alkuklimpinkoko = 6;
Erivareja = 6;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 480;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 10;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 10;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 707 MovieClip in Symbol 708 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 723 MovieClip Frame 1
stop();
Symbol 723 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 11;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 6;
tuhlailu = 6;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 46) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 15) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 24;
while (i <= 39) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 16;
while (i <= 23) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 40;
while (i <= 46) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 7;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 6;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 460;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 11;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 11;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 722 MovieClip in Symbol 723 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 737 MovieClip Frame 1
stop();
Symbol 737 MovieClip Frame 2
function setyf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((0 * xx) + (0.8660254 * yy));
}
function setxf(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((1 * xx) + (0.5 * yy));
}
function gety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((axis1x * yy) - (xx * axis1y)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function getx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return(((xx * axis2y) - (axis2x * yy)) / ((axis1x * axis2y) - (axis2x * axis1y)));
}
function sety(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1y * xx) + (axis2y * yy));
}
function setx(xx, yy) {
xx = xx * 1;
yy = yy * 1;
return((axis1x * xx) + (axis2x * yy));
}
function asetainfo(tuhlailu) {
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
i = 1;
while (i <= tuhlailu) {
if (!this["tuhlaus" + i]) {
attachMovie("tileydinpommi", "tuhlaus" + i, 789789 + i);
}
this["tuhlaus" + i].mc.targetalpha = 100;
this["tuhlaus" + i]._xscale = (this["tuhlaus" + i]._yscale = 50);
this["tuhlaus" + i]._y = (i * 20) - 5;
this["tuhlaus" + i]._x = 15;
i++;
}
}
function init() {
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
if (!isReset) {
levelCntr = 12;
scoring = 10;
multiplier = "";
gridspeed = 20;
}
isGridClear = false;
tuhlailulim = 6;
tuhlailu = 6;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
asetainfo(tuhlailu);
palloilmassa = 0;
gridsBallCntr = 0;
seuraavapallo = 1;
asetaseuraavapallo();
line_mc._visible = true;
ammuttu = 0;
d = 100;
rowsCurrentlyInGrid = -2;
popattavia = 0;
framerate = 0;
framejalaskettu = 0;
framenalkuaika = 0;
attachMovie("Tausta", "Tausta", 20);
kellonalkuaika = -999999;
kellonkesto = 7000;
Tausta._x = 275;
Tausta._y = 200;
Tausta._visible = false;
palloja_ammuttu = 0;
currentselectedsum = "0 / 10";
GridWidth = 5;
GameOver = false;
_global.gameon = false;
gametime = 20000;
levelper6 = "0";
_global.onnitteluja = false;
PointsThrown = 0;
animaationpituus = 9;
kerroin = 0.1;
attachMovie("Lopputiski", "lopputiski", 19);
this.lopputiski._visible = false;
this.lopputiski._x = 250.02;
this.lopputiski._y = 250.02;
if (!_global.onnitteluja) {
this.samplegrid._visible = true;
this.transformationlist._visible = true;
_global.gameon = true;
}
gamesinthislevel = 3;
tempPoints = 0;
Points = 0;
_global.lopputulema = Points;
Score = "" + Math.round(tempPoints);
valitunpallonkoko = 105;
valitsemattomankoko = 90;
level = 1;
levelper6 = level + "/6";
edellinenoikein = 0;
oikein = 0;
_global.lopputulos = "0";
Copiesleft = "" + ((gamesinthislevel + edellinenoikein) - oikein);
hiirenseuraaja._xscale = 10;
hiirenseuraaja._yscale = 10;
hiirenseuraaja._x = 100;
hiirenseuraaja._y = 100;
rotationtime = -10000;
hiirenseuraaja._visible = false;
attachMovie("empty", "grid", 0);
attachMovie("empty", "shots", 2);
attachMovie("empty", "scoreEffects", 1);
scoreEffects._x = (scoreEffects._y = 0);
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
shots._x = 0;
shots._y = 0;
initGrid();
isReset = false;
}
function kiinnita(luku, ii, jj, nimi, xv, yv, poistetaanko) {
gridsBallCntr++;
grid.attachMovie("file" + luku, nimi, grid.getNextHighestDepth());
grid[nimi]._xscale = (grid[nimi]._yscale = 100 * GRID_SIZE);
grid[nimi].muni = ii;
grid[nimi].munj = jj;
grid[nimi].munsisalto = luku;
grid[nimi]._visible = true;
grid[nimi]._x = setxf(jj * tileW, ii * tileH);
grid[nimi]._y = setyf(jj * tileW, ii * tileH);
grid[nimi].gotoAndPlay(1);
grid[nimi]._rotation = -grid._rotation;
xxx = setx(jj * tileW, ii * tileH);
yyy = sety(jj * tileW, ii * tileH);
lenin = Math.sqrt((xxx * xxx) + (yyy * yyy));
xxx = xxx / lenin;
yyy = yyy / lenin;
uusxxx = -yyy;
uusyyy = xxx;
dpdp = (uusxxx * xv) + (uusyyy * yv);
gridspeed = gridspeed + ((7 * (dpdp - (lenin * Math.sin((gridspeed / 180) * 3.141592)))) * Math.pow(1 / (1 + gridsBallCntr), 1));
grid[nimi].solid = true;
grid[nimi].onEnterFrame = function () {
oikeax = setx(this.munj * tileW, this.muni * tileH);
oikeay = sety(this.munj * tileW, this.muni * tileH);
if (!GameOver) {
if ((((oikeax < leftBound) || (oikeax > rightBound)) || (oikeay < upperBound)) || (oikeay > lowerBound)) {
}
var i = 1;
while (i <= 46) {
if (this.hitTest(eval ("h" + i))) {
if (!varo) {
this.attachMovie("varopallo", "varo", getNextHighestDepth());
varo._alpha = 0;
}
varo._alpha = (varo._alpha * 0.9) + 6;
varo._x = 0;
varo._y = 0;
isShooting = false;
canonRotation = false;
grid._rotation = grid._rotation + 0;
tm--;
trace("tm : - " + tm);
trace("time : - " + times);
if (tm <= 0) {
tm = 50;
times--;
}
trace("time second " + times);
if (times <= 0) {
trace("enter enterd");
var looseSnd = new Sound();
looseSnd.attachSound("looseSnd");
looseSnd.start(0, 1);
GameOver = true;
ThrowError(oikeax + grid._x, oikeay + grid._y);
times = 2;
tm = 50;
}
}
i++;
}
}
};
if (poistetaanko) {
removeBlock(ii, jj);
}
laskeEriVarit();
}
function laskeEriVarit() {
var _local4 = new Array();
var _local5 = new Array();
var _local2 = 0;
var _local3 = 0;
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 0;
i++;
}
_local4[_local3] = 0;
_local5[_local3] = 0;
BFStunnus++;
while (_local3 <= _local2) {
iii = _local4[_local3];
jjj = _local5[_local3];
this["tatavaria" + grid[(("t_" + iii) + "_") + jjj].munsisalto]++;
iii = _local4[_local3] - 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3];
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] - 1;
jjj = _local5[_local3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
iii = _local4[_local3] + 1;
jjj = _local5[_local3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local2++;
_local4[_local2] = iii;
_local5[_local2] = jjj;
}
}
_local3++;
}
}
function removeBlock(ii, jj) {
var _local5 = new Array();
var _local6 = new Array();
var _local3 = 0;
var _local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
id = grid[(("t_" + ii) + "_") + jj].munsisalto;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
if (_local3 > 2) {
var _local9 = new Array();
var _local10 = new Array();
indexa3 = 0;
indexl3 = 0;
_local9[0] = 0;
_local10[0] = 0;
BFStunnus++;
while (indexa3 <= indexl3) {
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3];
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] + 1;
jjj = _local10[indexa3] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
iii = _local9[indexa3] - 1;
jjj = _local10[indexa3] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl3++;
_local9[indexl3] = iii;
_local10[indexl3] = jjj;
}
}
indexa3++;
}
_local5 = new Array();
_local6 = new Array();
_local3 = 0;
_local4 = 0;
_local5[_local4] = ii;
_local6[_local4] = jj;
BFStunnus++;
while (_local4 <= _local3) {
iii = _local5[_local4] - 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4];
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4];
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] - 1;
jjj = _local6[_local4] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
iii = _local5[_local4] + 1;
jjj = _local6[_local4] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if ((grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) && (grid[(("t_" + iii) + "_") + jjj].munsisalto == id)) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
_local3++;
_local5[_local3] = iii;
_local6[_local3] = jjj;
}
}
_local4++;
}
var _local7 = new Array();
var _local8 = new Array();
indexa2 = 0;
indexl2 = 0;
_local7[0] = 0;
_local8[0] = 0;
BFStunnus++;
while (indexa2 <= indexl2) {
iii = _local7[indexa2];
jjj = _local8[indexa2];
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2];
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] - 1;
jjj = _local8[indexa2] + 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
iii = _local7[indexa2] + 1;
jjj = _local8[indexa2] - 1;
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
grid[(("t_" + iii) + "_") + jjj].BFS = BFStunnus;
indexl2++;
_local7[indexl2] = iii;
_local8[indexl2] = jjj;
}
}
indexa2++;
}
poistettuja = 0;
var _local11 = 0;
while (_local11 <= indexl3) {
iii = _local9[_local11];
jjj = _local10[_local11];
if (grid[(("t_" + iii) + "_") + jjj]) {
if (grid[(("t_" + iii) + "_") + jjj].BFS != BFStunnus) {
ThrowPoints(scoring, grid._x + setx(jjj * tileW, iii * tileH), grid._y + sety(jjj * tileW, iii * tileH), grid[(("t_" + iii) + "_") + jjj]);
grid[(("t_" + iii) + "_") + jjj].removeMovieClip();
poistettuja++;
}
}
_local11++;
}
kirupaSound = new Sound(this);
kirupaSound.attachSound("startSnd");
kirupaSound.start(0, 1);
poistettuja = poistettuja + _local3;
gridsBallCntr = gridsBallCntr - poistettuja;
Points = Points + (poistettuja * scoring);
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
}
}
function cleanUp() {
var _local3 = GridWidth;
var _local4 = rowsCurrentlyInGrid;
var _local2 = 0;
while (_local2 < _local4) {
var _local1 = 0;
while (_local1 < _local3) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
grid[(("t_" + _local2) + "_") + _local1].removeMovieClip();
}
_local1++;
}
_local2++;
}
}
function removeSumsFromGrid() {
var _local3 = 0;
var _local4 = GridWidth;
var _local5 = rowsCurrentlyInGrid;
var _local2 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local2 = rowsCurrentlyInGrid - 30;
while (_local2 < _local5) {
var _local1 = 0;
while (_local1 < _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
tulos = 1;
if (grid[(("t_" + _local2) + "_") + _local1].valittu) {
tulos = 2;
}
if (tulos == 2) {
_local3 = _local3 + int(grid[(("t_" + _local2) + "_") + _local1].munsisalto);
}
}
_local1++;
}
_local2++;
}
currentselectedsum = _local3 + " / 10";
return(false);
}
function removeSelectedFromGrid() {
var _local5 = GridWidth;
var _local6 = rowsCurrentlyInGrid;
var _local3 = 0;
var _local4 = 0;
if (rowsCurrentlyInGrid > 30) {
}
_local3 = rowsCurrentlyInGrid - 30;
while (_local3 < _local6) {
var _local2 = 0;
while (_local2 < _local5) {
if (grid[(("t_" + _local3) + "_") + _local2]) {
tulos = 1;
if (grid[(("t_" + _local3) + "_") + _local2].valittu) {
tulos = 2;
}
if (tulos == 2) {
ThrowPoints(scoring, grid[(("t_" + _local3) + "_") + _local2]._x + grid._x, grid[(("t_" + _local3) + "_") + _local2]._y + grid._y);
grid[(("t_" + _local3) + "_") + _local2].removeMovieClip();
_local4++;
Points = Points + scoring;
Score = (_global.lopputulos = "" + Points);
_global.lopputulema = Points;
haiskore.send("scoreboard", "update_score", "Haasto", Points);
}
}
_local2++;
}
_local3++;
}
}
function poppaa() {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
popattavia--;
if (popattavia <= 0) {
clearInterval(ID);
}
}
function setNumbers(container, Width, Height) {
koko = Width * Height;
var _local1 = new Array();
do {
nyk = 0;
temppisum = 0;
while (nyk < koko) {
_local1[nyk] = random(9) + 1;
if ((temppisum + _local1[nyk]) > 10) {
_local1[nyk] = 10 - temppisum;
}
temppisum = temppisum + _local1[nyk];
if (temppisum == 10) {
temppisum = 0;
}
if (nyk == (koko - 1)) {
if (temppisum > 0) {
_local1[nyk] = _local1[nyk] + (10 - temppisum);
}
}
nyk++;
}
} while (_local1[koko - 1] == 10);
var _local3 = 0;
while (_local3 < koko) {
indeksi1 = _local3 + random(koko - _local3);
tempvalue = _local1[_local3];
_local1[_local3] = _local1[indeksi1];
_local1[indeksi1] = tempvalue;
_local3++;
}
nyk = 0;
_local3 = 0;
while (_local3 < Height) {
var _local2 = 0;
while (_local2 < Width) {
container[(("t_" + _local3) + "_") + _local2].munsisalto = _local1[nyk];
nyk++;
_local2++;
}
_local3++;
}
}
function randomColor() {
juritus = 0;
do {
juritus++;
tulos = random(Erivareja) + 1;
} while ((this["tatavaria" + tulos] == 0) && (juritus < 100));
return(tulos);
while (_local2 < 9) {
todnaksum = todnaksum + todnakit[_local2];
_local2++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function randomColor2() {
tulos = random(Erivareja) + 1;
return(tulos);
while (_local1 < 9) {
todnaksum = todnaksum + todnakit[_local1];
_local1++;
}
tulos = random(todnaksum);
todnaksum = 0;
indeksi = 0;
while (indeksi < 9) {
todnaksum = todnaksum + todnakit[indeksi];
if (todnaksum > tulos) {
return(indeksi + 1);
}
indeksi++;
}
return(-1);
}
function asetaitte(i, j, luku) {
if (grid[(("t_" + i) + "_") + j]) {
grid[(("t_" + i) + "_") + j].removeMovieClip();
} else {
gridsBallCntr++;
}
grid.attachMovie("file" + luku, (("t_" + i) + "_") + j, grid.getNextHighestDepth());
grid[(("t_" + i) + "_") + j].munsisalto = luku;
grid[(("t_" + i) + "_") + j]._xscale = (grid[(("t_" + i) + "_") + j]._yscale = GRID_SIZE * 100);
grid[(("t_" + i) + "_") + j]._x = setxf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j]._y = setyf(tileW * j, tileH * i);
grid[(("t_" + i) + "_") + j].gotoAndPlay(1);
grid[(("t_" + i) + "_") + j].solid = true;
}
function addRowToGrid() {
var _local2 = rowsCurrentlyInGrid;
var _local1 = -Math.floor(Alkuklimpinkoko / 2);
while (_local1 < ((-Math.floor(Alkuklimpinkoko / 2)) + Alkuklimpinkoko)) {
luku = randomColor();
grid.attachMovie("file" + luku, (("t_" + _local2) + "_") + _local1, grid.getNextHighestDepth());
gridsBallCntr++;
grid[(("t_" + _local2) + "_") + _local1].munsisalto = luku;
grid[(("t_" + _local2) + "_") + _local1]._xscale = (grid[(("t_" + _local2) + "_") + _local1]._yscale = GRID_SIZE * 100);
grid[(("t_" + _local2) + "_") + _local1]._x = setxf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1]._y = setyf(tileW * _local1, tileH * _local2);
grid[(("t_" + _local2) + "_") + _local1].gotoAndPlay(1);
grid[(("t_" + _local2) + "_") + _local1].solid = true;
_local1++;
}
rowsCurrentlyInGrid++;
}
function dist2(x1, y1, x2, y2) {
return(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
function testhit(xx, yy) {
var _local7 = Math.round(gety(xx - grid._x, yy - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local3 = Math.round(getx(xx - grid._x, yy - grid._y) / tileH) - 1;
var _local4 = _local3 + 2;
var _local2 = _local7;
while (_local2 <= _local8) {
var _local1 = _local3;
while (_local1 <= _local4) {
if (grid[(("t_" + _local2) + "_") + _local1]) {
if (dist2(setx(_local1 * tileW, _local2 * tileH) + grid._x, sety(_local1 * tileW, _local2 * tileH) + grid._y, xx, yy) < ((900 * GRID_SIZE) * GRID_SIZE)) {
return(true);
}
}
_local1++;
}
_local2++;
}
return(false);
}
function shootrandom() {
palloilmassa++;
luku = randomColor();
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
ang = (Math.random() * 2) * 3.141592;
factori = 1 + Math.random();
shots[nimi]._x = GridCenterX + ((Math.cos(ang) * 420) * factori);
shots[nimi]._y = GridCenterY + ((Math.sin(ang) * 420) * factori);
shots[nimi].xv = GridCenterX - shots[nimi]._x;
shots[nimi].yv = GridCenterY - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / 15;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shots[nimi].onEnterFrame = function () {
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!solid) && (_global.gameon)) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (testhit(this._x, this._y)) {
var _local7 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1;
var _local8 = _local7 + 2;
var _local5 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1;
var _local6 = _local5 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _local4 = _local7;
while (_local4 <= _local8) {
var _local3 = _local5;
while (_local3 <= _local6) {
if (!grid[(("t_" + _local4) + "_") + _local3]) {
ddd222 = dist2(grid._x + setx(_local3 * tileW, _local4 * tileH), grid._y + sety(_local3 * tileW, _local4 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _local4;
parasjj = _local3;
}
}
_local3++;
}
_local4++;
}
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, false);
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
}
};
}
function asetaseuraavapallo() {
seuraavapallo = seuraavaseuraavapallo;
Cursor.gotoAndStop(seuraavapallo);
attachMovie("file" + seuraavapallo, "ammuttavapallo", 28);
ammuttavapallo._y = canon._y + 3;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 100);
ammuttavapallo.targety = canon._y;
ammuttavapallo.targetscale = 100 * GRID_SIZE;
ammuttavapallo._x = canon._x + 1;
ammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
seuraavaseuraavapallo = randomColor();
canon.attachMovie("file" + seuraavaseuraavapallo, "ammuttavaammuttavapallo", 29);
canon.ammuttavaammuttavapallo._x = -25;
canon.ammuttavaammuttavapallo._y = 5;
canon.ammuttavaammuttavapallo._rotation = canon._rotation;
canon.ammuttavaammuttavapallo._xscale = (ammuttavaammuttavapallo._yscale = 60);
canon.ammuttavaammuttavapallo.targetscale = 60 * GRID_SIZE;
canon.ammuttavaammuttavapallo.onEnterFrame = function () {
this._xscale = (this._yscale = (0.95 * this._xscale) + (0.05 * this.targetscale));
this._y = (0.95 * this._y) + (0.05 * this.targety);
};
}
function shoot() {
if (palloilmassa > 0) {
return(undefined);
}
palloilmassa++;
luku = seuraavapallo;
ammuttavapallo._xscale = (ammuttavapallo._yscale = 0);
ammuttavapallo.targetscale = 0;
nimi = "t_" + palloja_ammuttu;
palloja_ammuttu++;
shots.attachMovie("file" + luku, nimi, shots.getNextHighestDepth());
shots[nimi].bounceCntr = 0;
shots[nimi]._xscale = (shots[nimi]._yscale = 100 * GRID_SIZE);
shots[nimi].koko = 100;
shots[nimi].munsisalto = luku;
shots[nimi]._visible = true;
shots[nimi]._x = canon._x;
shots[nimi]._y = canon._y;
shots[nimi].xv = this._xmouse - shots[nimi]._x;
shots[nimi].yv = this._ymouse - shots[nimi]._y;
len = Math.sqrt((shots[nimi].xv * shots[nimi].xv) + (shots[nimi].yv * shots[nimi].yv));
len = len / BALL_SPEED;
shots[nimi].xv = shots[nimi].xv / len;
shots[nimi].yv = shots[nimi].yv / len;
shots[nimi].ekaframe = true;
shots[nimi]._alpha = 100;
shots[nimi].gotoAndPlay(1);
shots[nimi].solid = false;
shots[nimi].eletty = 0;
shotSnd = new Sound(this);
shotSnd.attachSound("shootSnd");
shotSnd.start(0, 1);
shots[nimi].onEnterFrame = function () {
if ((((this._x < 0) || (this._x > 750)) || (this._y < 0)) || (this._y > 550)) {
this.bounceCntr = 8;
}
if (!_global.gameon) {
this.removeMovieClip();
}
this.eletty++;
if ((!this.solid) && (_global.gameon)) {
if (this.bounceCntr > 7) {
ThrowPoints2(this._x, this._y, this);
tuhlailu--;
asetainfo(tuhlailu);
ammuttavapallo.targetscale = 50;
palloilmassa--;
this.removeMovieClip();
return(undefined);
}
if (!this.ekaframe) {
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
} else {
this.ekaframe = false;
}
if (testhit(this._x, this._y)) {
var _loc8 = (Math.round(gety(this._x - grid._x, this._y - grid._y) / tileW) - 1);
var _loc9 = (_loc8 + 2);
var _loc6 = (Math.round(getx(this._x - grid._x, this._y - grid._y) / tileH) - 1);
var _loc7 = (_loc6 + 2);
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
this._y = this._y + (this.yv * 0.5);
this._x = this._x + (this.xv * 0.5);
if (testhit(this._x, this._y)) {
_loc8 = Math.round(gety(this._x - grid._x, this._y - grid._y) / tileH) - 1;
_loc9 = _loc8 + 2;
_loc6 = Math.round(getx(this._x - grid._x, this._y - grid._y) / tileW) - 1;
_loc7 = _loc6 + 2;
parasnimi = "";
parasdist = 9999999 /* 0x98967F */;
var _loc5 = _loc8;
while (_loc5 <= _loc9) {
var _loc4 = _loc6;
while (_loc4 <= _loc7) {
if (!grid[(("t_" + _loc5) + "_") + _loc4]) {
ddd222 = dist2(grid._x + setx(_loc4 * tileW, _loc5 * tileH), grid._y + sety(_loc4 * tileW, _loc5 * tileH), this._x, this._y);
if (parasdist > ddd222) {
parasdist = ddd222;
parasii = _loc5;
parasjj = _loc4;
}
}
_loc4++;
}
_loc5++;
}
oldpiste = Points;
kiinnita(this.munsisalto, parasii, parasjj, (("t_" + parasii) + "_") + parasjj, this.xv, this.yv, true);
if (oldpiste == Points) {
tuhlailu--;
}
asetainfo(tuhlailu);
palloilmassa--;
asetaseuraavapallo();
this.removeMovieClip();
return(undefined);
}
}
var i = 1;
while (i <= 12) {
if (this.hitTest(eval ("h" + i))) {
this.xv = Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 26;
while (i <= 37) {
if (this.hitTest(eval ("h" + i))) {
this.xv = -Math.abs(this.xv);
this.bounceCntr++;
}
i++;
}
var i = 13;
while (i <= 25) {
if (this.hitTest(eval ("h" + i))) {
this.yv = Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
var i = 38;
while (i <= 46) {
if (this.hitTest(eval ("h" + i))) {
this.yv = -Math.abs(this.yv);
this.bounceCntr++;
}
i++;
}
};
}
function ThrowPoints(numbertothrow, xthrow, ythrow, alkupmovie) {
if (numbertothrow < 0) {
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 100;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 100;
if (numbertothrow > 0) {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "+" + numbertothrow;
} else {
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = numbertothrow;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 1.5;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._height = 30;
scoreEffects["ScoreEffect" + PointsThrown]._width = 30;
scoreEffects["ScoreEffect" + PointsThrown].ball.gotoAndPlay(2);
if (this.ball._currentframe == this.ball._totalframes) {
this.removeMovieClip();
}
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._alpha = this._alpha - 1.5;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowPoints2(xthrow, ythrow, alkupmovie) {
scoreEffects.attachMovie("file" + alkupmovie.munsisalto, "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._rotation = alkupmovie._rotation + this.grid._rotation;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowParticles(xthrow, ythrow) {
scoreEffects.attachMovie("file3", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 50;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 50;
scoreEffects["ScoreEffect" + PointsThrown].xv = (Math.random() * 10) - 5;
scoreEffects["ScoreEffect" + PointsThrown].yv = (Math.random() * 10) - 5;
if (xthrow < -250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv + 4;
}
if (xthrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].xv = scoreEffects["ScoreEffect" + PointsThrown].xv - 4;
}
if (ythrow > 250) {
scoreEffects["ScoreEffect" + PointsThrown].yv = scoreEffects["ScoreEffect" + PointsThrown].yv - 4;
}
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale - 2;
this._yscale = this._yscale - 2;
this._alpha = this._alpha - 1.5;
this._x = this._x + this.xv;
this._y = this._y + this.yv;
this._rotation = this._rotation + (this.xv * 10);
this.yv = this.yv + 1;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
}
function ThrowError(xthrow, ythrow) {
scoreEffects.attachMovie("ScoreEffectMinus", "ScoreEffect" + PointsThrown, 700000 + PointsThrown);
scoreEffects["ScoreEffect" + PointsThrown]._x = xthrow;
scoreEffects["ScoreEffect" + PointsThrown]._y = ythrow;
scoreEffects["ScoreEffect" + PointsThrown]._xscale = 110;
scoreEffects["ScoreEffect" + PointsThrown]._yscale = 110;
scoreEffects["ScoreEffect" + PointsThrown].Scoreaddition = "";
scoreEffects["ScoreEffect" + PointsThrown].onEnterFrame = function () {
this._xscale = this._xscale + 1;
this._yscale = this._yscale + 1;
this._alpha = this._alpha - 0.7;
if (this._alpha < 1.5) {
this.removeMovieClip();
}
};
PointsThrown++;
aj = 0;
while (aj < 30) {
ThrowParticles(xthrow, ythrow);
aj++;
}
}
function updateGrid() {
while ((!grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]) || ((grid._y + grid[(("t_" + (rowsCurrentlyInGrid - 1)) + "_") + 0]._y) > -20)) {
}
}
function initGrid() {
rand = levelCntr;
backgrounds_mc.gotoAndStop(rand);
if (rand == 1) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 2) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 3) {
Alkuklimpinkoko = 3;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 4) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 5) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 6) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 7) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 8) {
Alkuklimpinkoko = 5;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 9) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 10) {
Alkuklimpinkoko = 6;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 11) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
} else if (rand == 12) {
Alkuklimpinkoko = 4;
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
}
i = Alkuklimpinkoko - 1;
while (i > 0) {
j = 0;
while (j < (((2 * Alkuklimpinkoko) - 1) - i)) {
asetaitte(-i, (((-Alkuklimpinkoko) + 1) + i) + j, randomColor());
j++;
}
j = 0;
while (j < (((Alkuklimpinkoko * 2) - 1) - i)) {
asetaitte(i, ((Alkuklimpinkoko - 1) - i) - j, randomColor());
j++;
}
i--;
}
j = 0;
while (j < ((Alkuklimpinkoko * 2) - 1)) {
asetaitte(0, ((-Alkuklimpinkoko) + 1) + j, randomColor());
j++;
}
grid.t_0_0.removeMovieClip();
grid.attachMovie("tilepommi", "t_0_0", grid.getNextHighestDepth());
grid.t_0_0.munsisalto = -1;
grid.t_0_0._xscale = (grid.t_0_0._yscale = GRID_SIZE * 100);
}
function nextLevel() {
_root.nextLevelUpdate = true;
_root.levelUpdate();
popupOpend = false;
gameStatus = "running";
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc.targetalpha = 0;
this["tuhlaus" + i].mc.targetscale = 0;
}
i++;
}
isShooting = true;
levelCntr++;
if (levelCntr == 1) {
Erivareja = 2;
tuhlailulim = 10;
tuhlailu = 10;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 2) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 3;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 3) {
tuhlailulim = 10;
tuhlailu = 10;
Erivareja = 4;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 4) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 5;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 5) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 6;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 6) {
tuhlailulim = 9;
tuhlailu = 9;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 7) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 8) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 9) {
tuhlailulim = 7;
tuhlailu = 7;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 10) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 11) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
} else if (levelCntr == 12) {
tuhlailulim = 6;
tuhlailu = 6;
Erivareja = 7;
asetainfo(tuhlailu);
i = 0;
while (i <= Erivareja) {
this["tatavaria" + i] = 1;
i++;
}
}
}
function showLevelPopup() {
levelup_mc._visible = true;
levelup_mc.swapDepths(this.getNextHighestDepth());
}
_root.mybgSnd.start(0, 999);
Mouse.hide();
var Cursor = this.attachMovie("Cursor", "Cursor", 512000);
_global.Mana = 50;
Cursor._x = 200;
Cursor._y = 200;
Cursor._xscale = 75;
Cursor._yscale = 75;
Cursor.startDrag(true);
Cursor.Core._visible = false;
Cursor.Spin = 0;
Cursor.Col = 1;
Cursor.Speed = 0.5;
Cursor.Track = -5;
Cursor.SpinRate = 5;
Cursor.onEnterFrame = function () {
this.Spin = this.Spin + this.SpinRate;
this._rotation = this._rotation + ((_global.Mana / 4) + 8);
if (MouseDown) {
this.ColMod = seuraavapallo + 7;
} else {
this.ColMod = seuraavapallo;
}
this.gotoAndStop(this.ColMod);
};
var times = 2;
var tm = 50;
var canonRotation = true;
_xmouse = 200;
_ymouse = 200;
gameend_mc._visible = false;
levelup_mc._visible = false;
isShooting = true;
isInited = false;
Pallojapersatsi = 10;
GRID_SIZE = 0.75006;
BALL_SPEED = 20;
Alkuklimpinkoko = 6;
Erivareja = 7;
ArrowCenterX = 450;
GridCenterX = 415;
GridCenterY = 270;
multiplier = "";
scoring = 10;
isGridClear = false;
lowerBound = 195;
upperBound = -180;
leftBound = -180;
rightBound = 210;
createEmptyMovieClip("line_mc", 10);
gridspeed = 0;
gridsBallCntr = 0;
palloilmassa = 0;
canon._x = GridCenterX;
canon._y = 450;
seuraavapallo = 1;
seuraavaseuraavapallo = 2;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
BFStunnus = 0;
ampuaika = getTimer() + 1000;
ammuttu = 0;
axis1x = 1;
axis1y = 0;
axis2x = 0.5;
axis2y = 0.8660254;
levelCntr = 12;
isReset = false;
lastScore = 0;
tileW = 34 * GRID_SIZE;
tileH = 34 * GRID_SIZE;
isMouseDown = false;
onMouseDown = function () {
MouseDown = true;
if (isShooting) {
isMouseDown = true;
}
};
var time = 100;
var time2 = 2;
onMouseUp = function () {
MouseDown = false;
isMouseDown = false;
};
edellinenaika = getTimer();
aikakerroin = 1;
var spacepohjassaviimeframessa = false;
edaika = 0;
var gameStatus = "running";
var kk = 25;
var count = 2;
var popupOpend = false;
onEnterFrame = function () {
uusiaika = getTimer();
aikakerroin = (uusiaika - edellinenaika) / 33;
edellinenaika = uusiaika;
framejalaskettu++;
if (framejalaskettu >= 30) {
framerate = (1000 * (framejalaskettu * 1)) / ((1 * (getTimer() - framenalkuaika)) + 0.001);
framenalkuaika = getTimer();
framejalaskettu = 0;
}
if (!_global.gameon) {
gridinaloitus = getTimer();
} else {
if ((gridsBallCntr <= 1) && (isGridClear == false)) {
isShooting = false;
if (levelCntr < 12) {
grid.targetscale = 0;
removeMovieClip(Cursor);
if (gameStatus == "running") {
gameStatus == "null";
kk--;
if (kk <= 0) {
kk = 25;
count--;
}
if (count <= 0) {
if (popupOpend == false) {
popupOpend = true;
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
Mouse.show();
Cursor.removeMovieClip();
_root.playerDetails.data.lev = 12;
levelup_mc._visible = true;
_root.mybgSnd.stop();
_root.popSnd.start(0, 1);
canonRotation = false;
var _local4 = new mx.transitions.Tween(levelup_mc, "_y", mx.transitions.easing.Strong.easeOut, levelup_mc._y, 90, 2, true);
_local4.onMotionFinished = function () {
_root.mainScore = _root.mainScore + Number(Score);
};
}
kk = 25;
count = 2;
}
}
} else {
levelCntr = 1;
gotoAndStop ("gamecompleted");
}
}
if ((isGridClear == true) && (grid._xscale < 2)) {
isGridClear = false;
initGrid();
grid._xscale = (grid._yscale = 0);
grid.targetscale = 100;
scoring = scoring + 10;
multiplier = scoring + "x";
}
grid._xscale = (grid._yscale = (0.95 * grid._xscale) + (0.05 * grid.targetscale));
i = 1;
while (i <= 10) {
if (this["tuhlaus" + i]) {
this["tuhlaus" + i].mc._alpha = (this["tuhlaus" + i].mc._alpha * 0.95) + (this["tuhlaus" + i].mc.targetalpha * 0.05);
}
i++;
}
gridspeed = gridspeed * 0.95455;
if (_ymouse < 470) {
if (canonRotation) {
canon._rotation = (Math.atan2(_ymouse - canon._y, _xmouse - canon._x) / 3.14159) * 180;
ammuttavapallo._rotation = canon._rotation;
ammuttavaammuttavapallo._rotation = canon._rotation;
}
}
line_mc._visible = true;
hidastuskerroin = 1;
if (getTimer() < (kellonalkuaika + kellonkesto)) {
hidastuskerroin = 0.3;
}
if (((((!isGridClear) && (isMouseDown)) && (_ymouse < 470)) && (Math.abs(gridspeed) < 2)) && (palloilmassa == 0)) {
hiirenseuraaja._x = _xmouse;
hiirenseuraaja._y = _ymouse;
if (!hiirenseuraaja.hitTest(Neppula)) {
shoot();
bubblePop = new Sound(this);
bubblePop.attachSound("FOLEY WHIP WHOOSH DOUBLE ALUMINUM ROD 01");
bubblePop.start(0, 1);
isMouseDown = false;
}
}
if (tuhlailu == 0) {
whoosi = new Sound(this);
whoosi.attachSound("ropes_whoosh");
whoosi.start(0, 1);
i = 0;
while (i < Pallojapersatsi) {
shootrandom();
i++;
}
tuhlailulim--;
if (tuhlailulim == 0) {
if (levelCntr == 1) {
Erivareja = 2;
} else if (levelCntr == 2) {
tuhlailulim = 10;
} else if (levelCntr == 3) {
tuhlailulim = 10;
} else if (levelCntr == 4) {
tuhlailulim = 9;
} else if (levelCntr == 5) {
tuhlailulim = 9;
} else if (levelCntr == 6) {
tuhlailulim = 9;
} else if (levelCntr == 7) {
tuhlailulim = 7;
} else if (levelCntr == 8) {
tuhlailulim = 7;
} else if (levelCntr == 9) {
tuhlailulim = 7;
} else if (levelCntr == 10) {
tuhlailulim = 6;
} else if (levelCntr == 11) {
tuhlailulim = 6;
} else if (levelCntr == 12) {
tuhlailulim = 6;
}
}
tuhlailu = tuhlailulim;
asetainfo(tuhlailu);
}
grid._x = GridCenterX;
grid._y = GridCenterY;
grid._rotation = grid._rotation + gridspeed;
ang = (grid._rotation * 3.141593) / 180;
axis1x = Math.cos(ang);
axis1y = Math.sin(ang);
axis2x = Math.cos(ang + 1.047197);
axis2y = Math.sin(ang + 1.047197);
line_mc._x = grid._x;
line_mc._y = grid._y;
vasein = 99999 /* 0x01869F */;
oikein = -99999;
ylin = -99999;
alin = 99999 /* 0x01869F */;
}
Score = "" + Math.round(tempPoints);
tempPoints = (0.93 * tempPoints) + (0.07 * Points);
if ((Points > 0) && (oldpo != Points)) {
bubblePop = new Sound(this);
bubblePop.attachSound("bubble");
bubblePop.start(0, 1);
}
oldpo = Points;
if ((GameOver == true) && (_global.gameon == true)) {
trace("gameover gameover");
if (kelloefekti) {
kelloefekti.removeMovieClip();
}
whoosh = new Sound(this);
whoosh.attachSound("Descending Gamey Blip");
whoosh.start(0, 1);
_global.gameon = false;
removeMovieClip(grid);
removeMovieClip(ammuttavapallo);
removeMovieClip(ammuttavaammuttavapallo);
_root.showGameOver();
}
};
init();
stop();
Instance of Symbol 736 MovieClip in Symbol 737 MovieClip Frame 2
on (rollOver) {
Mouse.show();
_parent.Cursor._visible = false;
this.useHandCursor = false;
_parent.isShooting = false;
_parent.canonRotation = false;
}
on (rollOut) {
Mouse.hide();
_parent.Cursor._visible = true;
_parent.canonRotation = true;
_parent.isShooting = true;
}
Symbol 776 Button
on (release) {
_root.submitScore();
}
Symbol 777 Button
on (release) {
_root.moreGames();
}
Symbol 778 Button
on (release) {
_root.playAgain();
}
Symbol 780 Button
on (release) {
_root.moreGames();
}
on (rollOver) {
Mouse.show();
}
Symbol 781 MovieClip Frame 1
stop();
Instance of Symbol 740 MovieClip in Symbol 781 MovieClip Frame 1
on (rollOver) {
this.useHandCursor = false;
Mouse.show();
}
Symbol 781 MovieClip Frame 60
stop();
Symbol 783 MovieClip Frame 1
stop();
Instance of Symbol 740 MovieClip in Symbol 783 MovieClip Frame 1
on (rollOver) {
this.useHandCursor = false;
Mouse.show();
}
Symbol 783 MovieClip Frame 60
stop();