Section 1
//assetHolder_1 (Gearzzle_fla.assetHolder_1)
package Gearzzle_fla {
import flash.display.*;
public dynamic class assetHolder_1 extends MovieClip {
public function assetHolder_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Gearzzle_fla
Section 2
//info_text_10 (Gearzzle_fla.info_text_10)
package Gearzzle_fla {
import flash.display.*;
public dynamic class info_text_10 extends MovieClip {
public function info_text_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Gearzzle_fla
Section 3
//uput_1_nivo_22 (Gearzzle_fla.uput_1_nivo_22)
package Gearzzle_fla {
import flash.display.*;
public dynamic class uput_1_nivo_22 extends MovieClip {
public function uput_1_nivo_22(){
addFrameScript(503, frame504);
}
function frame504(){
stop();
}
}
}//package Gearzzle_fla
Section 4
//uput_2_nivo_23 (Gearzzle_fla.uput_2_nivo_23)
package Gearzzle_fla {
import flash.display.*;
public dynamic class uput_2_nivo_23 extends MovieClip {
public function uput_2_nivo_23(){
addFrameScript(503, frame504);
}
function frame504(){
stop();
}
}
}//package Gearzzle_fla
Section 5
//uput_3_nivo_24 (Gearzzle_fla.uput_3_nivo_24)
package Gearzzle_fla {
import flash.display.*;
public dynamic class uput_3_nivo_24 extends MovieClip {
public function uput_3_nivo_24(){
addFrameScript(528, frame529);
}
function frame529(){
stop();
}
}
}//package Gearzzle_fla
Section 6
//uput_4_nivo_25 (Gearzzle_fla.uput_4_nivo_25)
package Gearzzle_fla {
import flash.display.*;
public dynamic class uput_4_nivo_25 extends MovieClip {
public function uput_4_nivo_25(){
addFrameScript(264, frame265);
}
function frame265(){
stop();
}
}
}//package Gearzzle_fla
Section 7
//Choose_Level (Choose_Level)
package {
import flash.display.*;
public dynamic class Choose_Level extends MovieClip {
public function Choose_Level(){
addFrameScript(37, frame38);
}
function frame38(){
stop();
}
}
}//package
Section 8
//Choose_level_Class (Choose_level_Class)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Choose_level_Class extends MovieClip {
var _lvlThumb:levelThumbClass;
var level_number_thumb:int;
var MuzikaAkcija:Dopekick;
var so:SharedObject;
var i:int;
var otkljucaniNivoi:int;
var _choose_lvl:Choose_Level;
var level_available:int;// = 1
var _lvlThumbArray:Array;
public function Choose_level_Class(){
_lvlThumbArray = new Array();
level_available = 1;
so = SharedObject.getLocal("Otkljucani");
otkljucaniNivoi = so.data.nivo;
MuzikaAkcija = new Dopekick();
super();
_choose_lvl = new Choose_Level();
addChild(_choose_lvl);
i = 0;
while (i < 20) {
level_number_thumb = (i + 1);
if (i == otkljucaniNivoi){
level_available = 2;
};
_lvlThumb = new levelThumbClass(level_number_thumb, level_available);
_lvlThumb.x = ((-347 + ((i % 5) * 70)) + ((i % 2) * 960));
_lvlThumb.y = (140 + (int((i / 5)) * 65));
_lvlThumb.addEventListener("myCustomEvent", dugme_level_klik, false, 0, true);
this.addEventListener(Event.ENTER_FRAME, let_dugmadi, false, 0, true);
addChild(_lvlThumb);
_lvlThumbArray.push(_lvlThumb);
i++;
};
}
private function let_dugmadi(_arg1:Event):void{
var _local2:int;
_local2 = 20;
i = 0;
while (i < 20) {
if ((i % 2) == 0){
_lvlThumbArray[i].x = (_lvlThumbArray[i].x + _local2);
} else {
_lvlThumbArray[i].x = (_lvlThumbArray[i].x - _local2);
};
i++;
};
if (_lvlThumbArray[0].x > 115){
this.removeEventListener(Event.ENTER_FRAME, let_dugmadi);
};
}
private function dugme_level_klik(_arg1:myCustomEvent):void{
mainMenu.MuzikaChannel.stop();
if (mainMenu.MuzickaLogika == 1){
mainMenu.MuzikaChannel = MuzikaAkcija.play(0, 999);
};
trace("Odabran je nivo:", _arg1.myMessage);
GameMain.aktuelniNivo = _arg1.myMessage;
this.removeEventListener(Event.ENTER_FRAME, let_dugmadi);
GameMain.game_state = 3;
dispatchEvent(new promenaStanjaIgre());
}
}
}//package
Section 9
//Collision_update (Collision_update)
package {
import flash.geom.*;
import flash.display.*;
public class Collision_update extends MovieClip {
public function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Rectangle{
var _local6:Rectangle;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
return (_local6);
}
public static function getCollisionRect(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Rectangle{
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Rectangle;
var _local9:BitmapData;
var _local10:BitmapData;
var _local11:uint;
var _local12:Rectangle;
var _local13:int;
_local6 = _arg1.getBounds(_arg3);
_local7 = _arg2.getBounds(_arg3);
_local8 = _local6.intersection(_local7);
if (_local8.size.length > 0){
if (_arg4){
_local8.width = Math.ceil(_local8.width);
_local8.height = Math.ceil(_local8.height);
_local9 = getAlphaMap(_arg1, _local8, BitmapDataChannel.RED, _arg3);
_local10 = getAlphaMap(_arg2, _local8, BitmapDataChannel.GREEN, _arg3);
_local9.draw(_local10, null, null, BlendMode.LIGHTEN);
if (_arg5 <= 0){
_local11 = 65792;
} else {
if (_arg5 > 1){
_arg5 = 1;
};
_local13 = Math.round((_arg5 * 0xFF));
_local11 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local12 = _local9.getColorBoundsRect(_local11, _local11);
_local9.getColorBoundsRect(_local11, _local11).x = (_local12.x + _local8.x);
_local12.y = (_local12.y + _local8.y);
return (_local12);
} else {
return (_local8);
};
//unresolved jump
};
return (null);
}
public static function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Point{
var _local6:Rectangle;
var _local7:Number;
var _local8:Number;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
_local7 = ((_local6.left + _local6.right) / 2);
_local8 = ((_local6.top + _local6.bottom) / 2);
return (new Point(_local7, _local8));
};
return (null);
}
private static function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:DisplayObjectContainer):BitmapData{
var _local5:Matrix;
var _local6:Matrix;
var _local7:BitmapData;
var _local8:BitmapData;
_arg4 = _arg1.parent;
_local5 = _arg4.transform.concatenatedMatrix.clone();
_local5.invert();
_local6 = _arg1.transform.concatenatedMatrix.clone();
_local6.concat(_local5);
_local6.translate(-(_arg2.x), -(_arg2.y));
_local7 = new BitmapData(_arg2.width, _arg2.height, true, 0);
_local7.draw(_arg1, _local6);
_local8 = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local8.copyChannel(_local7, _local7.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local8);
}
}
}//package
Section 10
//Dopekick (Dopekick)
package {
import flash.media.*;
public dynamic class Dopekick extends Sound {
}
}//package
Section 11
//GameLoop (GameLoop)
package {
import flash.events.*;
import flash.display.*;
public class GameLoop extends MovieClip {
public var titleStarted:Boolean;// = false
public var percentLoaded:int;
public var gameState:int;// = 0
public var loaderStarted:Boolean;// = false
public var loadingBox:LoadingBox;
public static const STATE_SYSTEM_LOADER:int = 0;
public static const STATE_SYSTEM_TITLE:int = 1;
public function GameLoop():void{
gameState = STATE_SYSTEM_LOADER;
loaderStarted = false;
titleStarted = false;
super();
addFrameScript(0, frame1, 2, frame3);
addEventListener(Event.ENTER_FRAME, runGame);
}
public function runGame(_arg1:Event):void{
switch (gameState){
case STATE_SYSTEM_LOADER:
doLoadScreen();
break;
case STATE_SYSTEM_TITLE:
doTitleScreen();
break;
};
}
function frame3(){
stop();
}
function frame1(){
stop();
}
public function doTitleScreen():void{
var _local1:GameMain;
if (((!(titleStarted)) && ((currentFrame == 3)))){
_local1 = new GameMain();
addChild(_local1);
titleStarted = true;
};
}
public function loadingProgress(_arg1:Event):void{
percentLoaded = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
trace(percentLoaded);
loadingBox.update(percentLoaded);
}
public function loadingComplete(_arg1:Event){
trace("loadingComplete");
removeChild(loadingBox);
loadingBox = null;
this.loaderInfo.removeEventListener(Event.COMPLETE, loadingComplete);
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadingProgress);
finishPreload();
}
public function doLoadScreen():void{
trace(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
if (!loaderStarted){
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
finishPreload();
} else {
loadingBox = new LoadingBox();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, loadingComplete);
loaderStarted = true;
loadingBox.x = 0;
loadingBox.y = 0;
addChild(loadingBox);
};
};
}
public function finishPreload():void{
this.play();
gameState = STATE_SYSTEM_TITLE;
}
}
}//package
Section 12
//GameMain (GameMain)
package {
import flash.display.*;
import flash.net.*;
public class GameMain extends MovieClip {
var _choose_level:Choose_level_Class;
var _menu:mainMenu;
var _level_clip:levelGameClass;
static var aktuelniNivo = 1;
static var game_state:int = 0;
static var so:SharedObject;
public function GameMain(){
so = SharedObject.getLocal("Otkljucani");
if (so.data.nivo == undefined){
so.data.nivo = 1;
so.flush();
so.close();
};
_menu = new mainMenu();
_menu.addEventListener("promenaStanjaIgre", glavna_petlja, false, 0, true);
addChild(_menu);
}
private function glavna_petlja(_arg1:promenaStanjaIgre):void{
switch (game_state){
case 2:
_menu.removeEventListener("promenaStanjaIgre", glavna_petlja);
removeChild(_menu);
_choose_level = new Choose_level_Class();
_choose_level.addEventListener("promenaStanjaIgre", glavna_petlja, false, 0, true);
addChild(_choose_level);
break;
case 3:
_choose_level.removeEventListener("promenaStanjaIgre", glavna_petlja);
removeChild(_choose_level);
_level_clip = new levelGameClass();
_level_clip.addEventListener("promenaStanjaIgre", glavna_petlja, false, 0, true);
addChild(_level_clip);
break;
case 4:
_level_clip.removeEventListener("promenaStanjaIgre", glavna_petlja);
removeChild(_level_clip);
_level_clip = new levelGameClass();
_level_clip.addEventListener("promenaStanjaIgre", glavna_petlja, false, 0, true);
addChild(_level_clip);
break;
case 5:
game_state = 0;
_level_clip.removeEventListener("promenaStanjaIgre", glavna_petlja);
removeChild(_level_clip);
_menu = new mainMenu();
_menu.addEventListener("promenaStanjaIgre", glavna_petlja, false, 0, true);
addChild(_menu);
break;
};
}
}
}//package
Section 13
//gearClass4 (gearClass4)
package {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
public class gearClass4 extends MovieClip {
public var look_zupcanika:int;
var _brojZub:int;
var korak:int;// = 5
var smer_rotacije:Number;
var samoukidanje:Boolean;
public var status_zupcanika:int;
var rotacija:Boolean;
var collisiondetection:Collision_update;
var look:int;
var _poluprecnik:int;
var delta_x:int;
var delta_y:int;
var _postojanje:Boolean;
public var probni:int;
var niz_deltax:Array;
var niz_deltay:Array;
var distanca:Number;
public function gearClass4(_arg1){
korak = 5;
niz_deltax = [0, -1, 0, 1];
niz_deltay = [-1, 0, 1, 0];
super();
status_zupcanika = 1;
collisiondetection = new Collision_update();
samoukidanje = false;
_postojanje = true;
smer_rotacije = 99;
if (_arg1 == 1){
smer_rotacije = 2;
};
this.gotoAndStop(_arg1);
look = _arg1;
_brojZub = levelGameClass.broj_zubaca[(look - 1)];
_poluprecnik = int((this.width / 2));
this.addEventListener(Event.ENTER_FRAME, pitanje_rotacije, false, 0, true);
}
private function checkCollision():void{
var _local1:int;
var _local2:Boolean;
var _local3:int;
var _local4:int;
var _local5:Rectangle;
var _local6:int;
var _local7:int;
_local1 = levelGameClass.gear_Array.length;
_local2 = false;
_local3 = 99;
if (look != 1){
this.smer_rotacije = 99;
_local4 = 0;
while (_local4 < _local1) {
if (_local4 != levelGameClass.gear_Array.indexOf(this)){
_local5 = collisiondetection.isColliding(this, levelGameClass.gear_Array[_local4], stage, true, 0);
if (_local5 != null){
if (_local5.width != 0){
_local6 = levelGameClass.gear_Array[_local4]._poluprecnik;
_local7 = levelGameClass.gear_Array[_local4]._brojZub;
if (Math.abs(levelGameClass.gear_Array[_local4].smer_rotacije) < 99){
this.smer_rotacije = ((-(levelGameClass.gear_Array[_local4].smer_rotacije) * _local7) / _brojZub);
};
if (Math.abs(this.smer_rotacije) < 99){
if (((((_local3 / this.smer_rotacije) < 0)) && (!((_local3 == 99))))){
_local2 = true;
} else {
_local3 = this.smer_rotacije;
};
};
};
};
};
_local4++;
};
if (((_local2) && (!(levelGameClass.levelCollisionFlag)))){
trace("Kolizija smerova za zupcanik ", levelGameClass.gear_Array.indexOf(this));
levelGameClass.levelCollisionFlag = true;
if (levelGameClass.uzvicnik){
levelGameClass.uzvicnik.x = this.x;
levelGameClass.uzvicnik.y = this.y;
};
dispatchEvent(new myCustomEvent(8));
};
if ((((((look == 8)) && (!(_local2)))) && ((Math.abs(this.smer_rotacije) < 99)))){
levelGameClass.levelCompleteBeauty++;
};
if ((((((((look == 8)) && (!(_local2)))) && ((Math.abs(this.smer_rotacije) < 99)))) && (!(levelGameClass.levelCompleteFlag)))){
levelGameClass.levelCompleteFlag = true;
trace("Kompletiran nivo");
dispatchEvent(new myCustomEvent(9));
};
};
if (Math.abs(this.smer_rotacije) < 99){
this.rotation = (this.rotation + smer_rotacije);
};
}
function pitanje_rotacije(_arg1:Event):void{
if (levelGameClass.Status_rotacije == 1){
checkCollision();
};
if ((((((levelGameClass.Status_rotacije == 0)) && ((status_zupcanika == 2)))) && ((this.alpha == 1)))){
this.alpha = 0.5;
this.addEventListener(Event.ENTER_FRAME, pregled, false, 0, true);
};
if (levelGameClass.Status_rotacije == 99){
gearRemoval();
};
}
function zup_ostaje():void{
if (status_zupcanika == 2){
status_zupcanika = 1;
this.alpha = 1;
levelGameClass.Status_rotacije = 1;
this.removeEventListener(Event.ENTER_FRAME, pregled);
trace("Zupcanik miruje");
};
}
private function gearRemoval():void{
var _local1:int;
trace("Skinuti su listeneri zupcanika:", levelGameClass.gear_Array.indexOf(this));
if (this){
if (_postojanje){
_postojanje = false;
this.removeEventListener(Event.ENTER_FRAME, pitanje_rotacije);
this.removeEventListener(Event.ENTER_FRAME, pregled);
parent.removeChild(this);
_local1 = levelGameClass.gear_Array.indexOf(this);
levelGameClass.gear_Array[_local1] = null;
levelGameClass.gear_Array.splice(_local1, 1);
trace("Duzina niza:", levelGameClass.gear_Array.length);
if (levelGameClass.gear_Array.length == 0){
dispatchEvent(new myCustomEvent(10));
};
};
};
}
function pregled(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Number;
var _local14:Number;
var _local15:int;
var _local16:int;
var _local17:Array;
var _local18:Array;
var _local19:int;
var _local20:int;
var _local21:Rectangle;
var _local22:int;
_local10 = 11;
_local12 = levelGameClass.gear_Array.length;
_local13 = (int(_poluprecnik) - _local10);
_local14 = int(_poluprecnik);
_local2 = (this.x + (korak * niz_deltax[levelGameClass.zadatiSmer]));
_local3 = (this.y + (korak * niz_deltay[levelGameClass.zadatiSmer]));
_local4 = false;
if (levelGameClass._maze.hitTestPoint(_local2, _local3, true)){
_local4 = true;
_local15 = 0;
while (_local15 < _local12) {
if (_local15 != levelGameClass.gear_Array.indexOf(this)){
_local5 = (int(levelGameClass.gear_Array[_local15]._poluprecnik) - _local10);
_local6 = int(levelGameClass.gear_Array[_local15]._poluprecnik);
_local7 = (_local2 - levelGameClass.gear_Array[_local15].x);
_local8 = (_local3 - levelGameClass.gear_Array[_local15].y);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
if (_local9 < (_local13 + _local6)){
_local4 = false;
};
if (((_local4) && ((_local9 < (_local6 + _local14))))){
_local11 = _local15;
_local16 = 1;
while (_local16 < levelGameClass.gear_Array.length) {
levelGameClass.gear_Array[_local16].rotacija = false;
levelGameClass.gear_Array[_local16].smer_rotacije = 99;
_local16++;
};
};
};
_local15++;
};
};
if (_local4){
this.x = _local2;
this.y = _local3;
_local17 = [];
_local18 = [];
_local19 = 30;
_local16 = 0;
while (_local16 < _local19) {
_local17.push(this.rotation);
_local21 = collisiondetection.isColliding(this, levelGameClass.gear_Array[_local11], stage, true, 0);
this.rotation = (this.rotation + 3);
if (_local21 != null){
_local22 = (_local21.width * _local21.height);
_local18.push(_local22);
};
_local16++;
};
_local20 = 0;
_local16 = 1;
while (_local16 < _local19) {
if (_local18[_local16] < _local18[_local20]){
_local20 = _local16;
};
_local16++;
};
this.rotation = _local17[_local20];
} else {
zup_ostaje();
};
}
}
}//package
Section 14
//informationsClip (informationsClip)
package {
import flash.display.*;
public dynamic class informationsClip extends MovieClip {
public var cancel_dugme:myButton;
public var info_text:MovieClip;
public var info_dugme:myButton;
public function informationsClip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 15
//instructionsClip (instructionsClip)
package {
import flash.display.*;
public dynamic class instructionsClip extends MovieClip {
public var inst_dugme:SimpleButton;
}
}//package
Section 16
//Kompas (Kompas)
package {
import flash.display.*;
public dynamic class Kompas extends MovieClip {
public var str3:strela_2frejm;
public var str4:strela_2frejm;
public var str2:strela_2frejm;
public var str1:strela_2frejm;
}
}//package
Section 17
//LevelAnnounce (LevelAnnounce)
package {
import flash.display.*;
public dynamic class LevelAnnounce extends MovieClip {
}
}//package
Section 18
//levelGameClass (levelGameClass)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class levelGameClass extends MovieClip {
var _levelAnn:LevelAnnounce;
var _levelMask:LevelMask;
var delta_infoM:int;
var button_species:int;
var levelNum:int;
var i:int;
var _gear:gearClass4;
var gearXpozArray:Array;
var gearYpozArray:Array;
var gearStatus:Array;
var optimum_moves:Array;
var levelNumIndex:int;
var _kompas:Kompas;
var _infoM:informationsClip;
var pri:int;
var gearNumberArray:Array;
var _levelAnnBrojac:int;
public var nivoShow:TextField;
var gearLook:Array;
static var zadatiSmer:int;
static var levelCompleteBeauty:int;
static var gear_Array:Array;
static var number_moves:int;
static var Status_rotacije:int;
static var levelCollisionFlag:Boolean;
static var _maze:maze;
static var klik_zup:Boolean;
static var izgled_Zupcanika:int;
static var uzvicnik:uzvicnik_animat;
static var levelCompleteFlag:Boolean;
static var gearMovementFlag:Boolean;
static var broj_zubaca:Array;
public function levelGameClass(){
var _local1:Array;
var _local2:Array;
var _local3:myButtonClass;
var _local4:Array;
var _local5:Font;
var _local6:TextFormat;
optimum_moves = [3, 2, 3, 5, 10, 8, 10, 5, 9, 10, 10, 8, 11, 6, 12, 17, 16, 9, 12, 14];
super();
levelCompleteFlag = false;
levelCollisionFlag = false;
levelCompleteBeauty = 0;
levelNum = GameMain.aktuelniNivo;
levelNumIndex = (levelNum - 1);
Status_rotacije = 1;
delta_infoM = 20;
number_moves = 0;
gear_Array = new Array();
gearXpozArray = new Array();
gearYpozArray = new Array();
gearStatus = new Array();
gearLook = new Array();
gearNumberArray = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];
gearXpozArray[2] = [66, 11, 186, 224];
gearXpozArray[1] = [74, 118, 192, 239];
gearXpozArray[11] = [290, 235, 131, 130, 212, -3];
gearXpozArray[10] = [1, 81, -30, 106, 193, 322, 270, 294];
gearXpozArray[17] = [42, -30, 132];
gearXpozArray[9] = [0, 323, 240, 46, -28, 249];
gearXpozArray[8] = [6, 116, 259, 325, 324, 215];
gearXpozArray[5] = [16, 74, 155, 323, 296, 269];
gearXpozArray[13] = [-31, 247, 61, -31];
gearXpozArray[12] = [2, 72, 72, 167, 236, 288];
gearXpozArray[18] = [-30, 9, 137, 90, 208, 150, 316, 209, 254, 268, 45, 326];
gearXpozArray[15] = [48, 178, 172, 280, 271, 177];
gearXpozArray[19] = [65.4, 168.3, 223, 316.4, 246];
gearXpozArray[3] = [70, -27, 197, 248];
gearXpozArray[7] = [8, 10, 218, 225.3, 277.3];
gearXpozArray[6] = [-27, 40, 125, 159.3, 25.4, 288.3, 320];
gearXpozArray[14] = [11, 37, 95, 144, 225, 280];
gearXpozArray[4] = [-26, 95, 149, 200, 235, 310];
gearXpozArray[0] = [25, 90, 210, 150, 275];
gearXpozArray[16] = [-35, 112, 210, 132, 233, 298];
gearYpozArray[2] = [116, 38, 40, 130];
gearYpozArray[1] = [151, 39, 180, 69];
gearYpozArray[11] = [178, 209, 173, 70, 97, 97];
gearYpozArray[10] = [21, 80, 80, 174, 230, 179, 192, 22];
gearYpozArray[17] = [210, 80, 136];
gearYpozArray[9] = [59, 232, -10, -12, 145, 208];
gearYpozArray[8] = [55, 136, 54, 54, 136, 201];
gearYpozArray[5] = [20, 233, -12, 28, 85, 197];
gearYpozArray[13] = [145, 173, -10, -4];
gearYpozArray[12] = [28, 138, 204, 204, 202, 28];
gearYpozArray[18] = [233, 28, 203, 60, 177, 93, 134, 33, 210, 167, 2, -9];
gearYpozArray[15] = [223, 170, 43, 173, 62, -5];
gearYpozArray[19] = [116, 100, 100, 218.9, 148];
gearYpozArray[3] = [99, 225, 58, 154];
gearYpozArray[7] = [116, 55.4, 102, 228.8, 48];
gearYpozArray[6] = [116, 8, -10.6, 142.3, 226.3, 229.9, 27];
gearYpozArray[14] = [170, 55, 32, 87, 129, 38];
gearYpozArray[4] = [105, 33, 175, 32, 178, 102];
gearYpozArray[0] = [140, 201, 201, 12, 140];
gearYpozArray[16] = [111, 21, 21, 192, 192, 136];
gearLook[2] = [1, 5, 3, 8];
gearLook[1] = [1, 5, 5, 8];
gearLook[11] = [1, 5, 2, 7, 3, 8];
gearLook[10] = [1, 5, 6, 5, 7, 2, 2, 8];
gearLook[17] = [1, 5, 8];
gearLook[9] = [1, 2, 6, 7, 5, 8];
gearLook[8] = [1, 7, 2, 6, 5, 8];
gearLook[5] = [1, 7, 5, 3, 5, 8];
gearLook[13] = [1, 5, 7, 8];
gearLook[12] = [1, 5, 3, 2, 7, 8];
gearLook[18] = [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8];
gearLook[15] = [1, 3, 2, 6, 2, 8];
gearLook[19] = [1, 3, 3, 3, 8];
gearLook[3] = [1, 4, 7, 8];
gearLook[7] = [1, 4, 7, 5, 8];
gearLook[6] = [1, 7, 4, 5, 2, 3, 8];
gearLook[14] = [1, 5, 2, 4, 7, 8];
gearLook[4] = [1, 4, 7, 4, 2, 8];
gearLook[0] = [1, 5, 5, 7, 8];
gearLook[16] = [1, 4, 7, 5, 2, 8];
broj_zubaca = [6, 5, 6, 7, 8, 9, 10, 6];
_maze = new maze();
addChild(_maze);
_maze.x = 120;
_maze.y = 90;
_maze.gotoAndStop(levelNum);
_local1 = [150, 280, 410];
_local2 = [5, 6, 7];
_local4 = new Array();
i = 0;
while (i < 3) {
mainMenu.button_species = _local2[i];
_local3 = new myButtonClass();
_local3.x = _local1[i];
_local3.y = 380;
_local3.addEventListener("myCustomEvent", dugme_klik, false, 0, true);
_local3.scaleX = (_local3.scaleY = 0.7);
addChild(_local3);
_local4.push(_local3);
i++;
};
i = 0;
while (i < gearLook[levelNumIndex].length) {
_gear = new gearClass4(gearLook[levelNumIndex][i]);
_gear.probni = 4;
_gear.x = (gearXpozArray[levelNumIndex][i] + _maze.x);
_gear.y = (gearYpozArray[levelNumIndex][i] + _maze.y);
_gear.addEventListener("myCustomEvent", dugme_klik, false, 0, true);
addChild(_gear);
gear_Array.push(_gear);
i++;
};
_kompas = new Kompas();
_kompas.x = 700;
_kompas.y = 100;
i = 1;
while (i < 5) {
_kompas[("str" + i)].gotoAndStop(1);
_kompas[("str" + i)].str_dugme.addEventListener("odzivStrelica", str_klik);
i++;
};
addChild(_kompas);
this.addEventListener(MouseEvent.MOUSE_MOVE, moveCompass);
uzvicnik = new uzvicnik_animat();
addChild(uzvicnik);
uzvicnik.x = 650;
uzvicnik.y = 650;
_levelMask = new LevelMask();
_levelMask.x = 0;
_levelMask.y = 400;
addChild(_levelMask);
_levelAnn = new LevelAnnounce();
_levelAnn.x = 800;
_levelAnn.y = 200;
_levelAnn.addEventListener(Event.ENTER_FRAME, let_levelAnn, false, 0, true);
_levelAnnBrojac = 0;
addChild(_levelAnn);
_infoM = new informationsClip();
_infoM.x = 267;
_infoM.y = 550;
addChild(_infoM);
_infoM.info_dugme.natpis.gotoAndStop(8);
_infoM.cancel_dugme.natpis.gotoAndStop(9);
_infoM.cancel_dugme.natpis.mouseEnabled = false;
_infoM.info_dugme.natpis.mouseEnabled = false;
_infoM.info_dugme.addEventListener(MouseEvent.MOUSE_DOWN, info_reakcija, false, 0, true);
_infoM.cancel_dugme.addEventListener(MouseEvent.MOUSE_DOWN, info_cancel, false, 0, true);
_local5 = new Osnovni_font();
_local6 = new TextFormat();
_local6.font = _local5.fontName;
nivoShow.embedFonts = true;
nivoShow.text = ((((("level:" + levelNum) + " Moves made: ") + number_moves) + " Optimal number of moves: ") + optimum_moves[(GameMain.aktuelniNivo - 1)]);
nivoShow.setTextFormat(_local6);
}
function moveCompass(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:*;
if (Status_rotacije == 1){
pri = 99;
_local4 = false;
_local7 = 1;
while (_local7 < (gear_Array.length - 1)) {
_local5 = (stage.mouseX - gear_Array[_local7].x);
_local6 = (stage.mouseY - gear_Array[_local7].y);
_local3 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
if ((((((_local3 < (gear_Array[_local7]._poluprecnik + 10))) && ((_kompas.x == 700)))) || ((_local3 < (gear_Array[_local7]._poluprecnik - 10))))){
_kompas.x = (gear_Array[_local7].x - 2);
_kompas.y = gear_Array[_local7].y;
pri = _local7;
procenjivanje_kompas();
};
if (_local3 < (gear_Array[_local7]._poluprecnik + 10)){
_local4 = true;
_local2 = _local7;
};
_local7++;
};
if (pri == 99){
if (!_local4){
_kompas.x = 700;
} else {
pri = _local2;
};
};
};
}
private function info_cancel(_arg1:MouseEvent):void{
trace("info cancel");
_infoM.y = 550;
_levelMask.y = 400;
_infoM.removeEventListener(Event.ENTER_FRAME, let_infoM);
}
private function let_infoM(_arg1:Event):void{
_infoM.y = (_infoM.y - delta_infoM);
if (_infoM.y < 220){
trace("Prozor je stao");
_infoM.removeEventListener(Event.ENTER_FRAME, let_infoM);
if (levelCompleteFlag){
trace("Lepota kompletiranja:", levelCompleteBeauty);
};
};
}
private function pomeraj_infom():void{
_levelMask.y = 0;
_infoM.y = 1750;
_infoM.gotoAndStop(2);
_infoM.addEventListener(Event.ENTER_FRAME, let_infoM, false, 0, true);
}
function procenjivanje_kompas():void{
var _local1:Number;
var _local2:Number;
var _local3:Array;
var _local4:Array;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:int;
_local3 = [0, -1, 0, 1];
_local4 = [-1, 0, 1, 0];
_local6 = 5;
_local8 = gear_Array.length;
_local9 = 11;
_local10 = (int(gear_Array[pri]._poluprecnik) - _local9);
_local11 = int(gear_Array[pri]._poluprecnik);
_local17 = 0;
while (_local17 < 4) {
_local5 = false;
_local7 = (_local17 + 1);
_local1 = (gear_Array[pri].x + (_local6 * _local3[_local17]));
_local2 = (gear_Array[pri].y + (_local6 * _local4[_local17]));
if (_maze.hitTestPoint(_local1, _local2, true)){
_local5 = true;
_local18 = 0;
while (_local18 < _local8) {
if (_local18 != pri){
_local12 = (int(gear_Array[_local18]._poluprecnik) - _local9);
_local13 = int(gear_Array[_local18]._poluprecnik);
_local14 = (_local1 - gear_Array[_local18].x);
_local15 = (_local2 - gear_Array[_local18].y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
if (_local16 < (_local10 + _local13)){
_local5 = false;
};
};
_local18++;
};
};
if (_local5){
_kompas[("str" + _local7)].alpha = 1;
_kompas[("str" + _local7)].mouseChildren = true;
} else {
_kompas[("str" + _local7)].alpha = 0.2;
_kompas[("str" + _local7)].mouseChildren = false;
};
_local17++;
};
}
function str_klik(_arg1:odzivStrelica):void{
number_moves++;
nivoShow.text = ((((("level:" + levelNum) + " Moves made: ") + number_moves) + " Optimal number of moves: ") + optimum_moves[(GameMain.aktuelniNivo - 1)]);
Status_rotacije = 0;
_kompas.x = 700;
trace("Pri:", pri);
zadatiSmer = (int(_arg1.target.parent.name.charAt(3)) - 1);
gear_Array[pri].status_zupcanika = 2;
}
private function let_levelAnn(_arg1:Event):void{
if ((((_levelAnnBrojac < 26)) || ((_levelAnnBrojac > 50)))){
_levelAnn.x = (_levelAnn.x - 20);
};
if (_levelAnn.x < -300){
_levelAnn.removeEventListener(Event.ENTER_FRAME, let_levelAnn);
};
_levelAnnBrojac++;
}
private function info_reakcija(_arg1:MouseEvent):void{
var _local2:URLRequest;
if (_infoM.info_text.currentFrame != 3){
_levelMask.y = 400;
_infoM.info_dugme.removeEventListener(MouseEvent.MOUSE_DOWN, info_reakcija);
if (_infoM.cancel_dugme){
_infoM.cancel_dugme.removeEventListener(MouseEvent.MOUSE_DOWN, info_cancel);
};
_infoM.removeEventListener(Event.ENTER_FRAME, let_infoM);
Status_rotacije = 99;
} else {
_levelMask.y = 400;
_infoM.y = 550;
_infoM.removeEventListener(Event.ENTER_FRAME, let_infoM);
_local2 = new URLRequest(("http://10x10games.com/games/gearzzle/solution/solution.php?level=" + GameMain.aktuelniNivo));
navigateToURL(_local2, "_blank");
};
}
public function dugme_klik(_arg1:myCustomEvent):void{
switch (_arg1.myMessage){
case 5:
trace("Kliknut Restart nivoa");
GameMain.game_state = 4;
_infoM.info_text.gotoAndStop(1);
if (_infoM.hasEventListener(Event.ENTER_FRAME) == false){
_levelMask.y = 0;
_infoM.addEventListener(Event.ENTER_FRAME, let_infoM, false, 0, true);
};
break;
case 6:
trace("Kliknuto Povratak na meni");
GameMain.game_state = 5;
_infoM.info_text.gotoAndStop(2);
if (_infoM.hasEventListener(Event.ENTER_FRAME) == false){
_levelMask.y = 0;
_infoM.addEventListener(Event.ENTER_FRAME, let_infoM, false, 0, true);
};
break;
case 7:
trace("Kliknuto Solution");
_infoM.info_text.gotoAndStop(3);
if (_infoM.hasEventListener(Event.ENTER_FRAME) == false){
_levelMask.y = 0;
_infoM.addEventListener(Event.ENTER_FRAME, let_infoM, false, 0, true);
};
break;
case 8:
trace("Zupcanik prijavljuje kontrasmer");
_infoM.info_text.gotoAndStop(4);
GameMain.game_state = 4;
if ((((_infoM.hasEventListener(Event.ENTER_FRAME) == false)) && ((_infoM.y > 500)))){
pomeraj_infom();
};
break;
case 9:
_infoM.info_text.gotoAndStop(5);
GameMain.game_state = 4;
if (GameMain.aktuelniNivo < 21){
GameMain.aktuelniNivo++;
};
if (GameMain.so.data.nivo < GameMain.aktuelniNivo){
GameMain.so.data.nivo = GameMain.aktuelniNivo;
GameMain.so.flush();
GameMain.so.close();
};
if (GameMain.aktuelniNivo == 21){
_infoM.info_text.gotoAndStop(6);
GameMain.game_state = 5;
};
if ((((_infoM.hasEventListener(Event.ENTER_FRAME) == false)) && ((_infoM.y > 500)))){
pomeraj_infom();
};
break;
case 10:
removeChild(_maze);
_levelAnn.removeEventListener(Event.ENTER_FRAME, let_levelAnn);
dispatchEvent(new promenaStanjaIgre());
break;
};
}
}
}//package
Section 19
//LevelMask (LevelMask)
package {
import flash.display.*;
public dynamic class LevelMask extends MovieClip {
}
}//package
Section 20
//levelThumb (levelThumb)
package {
import flash.display.*;
public dynamic class levelThumb extends MovieClip {
public var lvlStrip:MovieClip;
public var thumbMask:MovieClip;
}
}//package
Section 21
//levelThumbClass (levelThumbClass)
package {
import flash.events.*;
import flash.display.*;
public class levelThumbClass extends MovieClip {
public var _levelnum:int;
public function levelThumbClass(_arg1:int, _arg2:int){
var _local3:levelThumb;
super();
_local3 = new levelThumb();
_levelnum = _arg1;
_local3.lvlStrip.gotoAndStop(this._levelnum);
_local3.thumbMask.gotoAndStop(_arg2);
_local3.lvlStrip.mouseEnabled = false;
if (_arg2 == 1){
_local3.addEventListener(MouseEvent.MOUSE_DOWN, klik_dugme, false, 0, true);
};
addChild(_local3);
}
private function klik_dugme(_arg1:MouseEvent):void{
dispatchEvent(new myCustomEvent(_levelnum));
}
}
}//package
Section 22
//LoadingBox (LoadingBox)
package {
import flash.display.*;
import flash.text.*;
public class LoadingBox extends MovieClip {
public var loading_txt:TextField;
public function LoadingBox(){
trace("loading box");
}
public function update(_arg1:int):void{
loading_txt.text = (String(_arg1) + "%");
}
}
}//package
Section 23
//mainMenu (mainMenu)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.net.*;
public class mainMenu extends MovieClip {
var stanje:int;
var button_type:Array;
var i:int;
var _button:myButtonClass;
var _buttonArray:Array;
var delta_instr:int;
private var Muzika:Ready_for_now;
var button_x_pos:Array;
var muzDug:muzDugme;
var zahtev_sendfriend:URLRequest;
var _instr:instructionsClip;
var button_counter:int;
static var MuzikaChannel:SoundChannel;
static var MuzickaLogika:int = 1;
static var button_species:int;
public function mainMenu(){
zahtev_sendfriend = new URLRequest("http://www.10x10games.com/games/gearzzle/send_to_friend/send.php");
super();
addFrameScript(51, frame52);
if (MuzikaChannel){
MuzikaChannel.stop();
};
GameMain.aktuelniNivo = 1;
button_x_pos = [-400, 938, -400, 938];
button_type = [1, 2, 3, 4];
_buttonArray = new Array();
button_counter = 0;
stanje = 1;
Muzika = new Ready_for_now();
i = 0;
while (i < 4) {
button_species = button_type[i];
_button = new myButtonClass();
_button.button_smer = (((i % 2))==0) ? 20 : -20;
_button.x = button_x_pos[i];
_button.y = (160 + (i * 50));
_button.addEventListener("myCustomEvent", dugme_klik, false, 0, true);
addChild(_button);
_buttonArray.push(_button);
i++;
};
_instr = new instructionsClip();
_instr.x = 270;
_instr.y = 550;
addChild(_instr);
_instr.inst_dugme.addEventListener(MouseEvent.MOUSE_DOWN, gasi_instr, false, 0, true);
muzDug = new muzDugme();
muzDug.x = 515;
muzDug.y = 375;
addChild(muzDug);
muzDug.MuzickoDugme.mouseEnabled = false;
muzDug.addEventListener(MouseEvent.MOUSE_DOWN, musiconoff, false, 0, true);
if (MuzickaLogika == 1){
MuzikaChannel = Muzika.play(0, 999);
} else {
muzDug.MuzickoDugme.gotoAndStop(2);
};
this.addEventListener(Event.ENTER_FRAME, button_run, false, 0, true);
}
private function button_run(_arg1:Event):void{
if (GameMain.game_state == 0){
button_counter++;
i = 0;
while (i < 4) {
_buttonArray[i].x = (_buttonArray[i].x + _buttonArray[i].button_smer);
if ((((button_counter == 35)) || ((button_counter == 40)))){
_buttonArray[i].button_smer = (_buttonArray[i].button_smer * -0.7);
};
if (button_counter == 44){
_buttonArray[i].button_smer = 0;
GameMain.game_state = 1;
};
i++;
};
};
}
function musiconoff(_arg1:MouseEvent):void{
muzDug.MuzickoDugme.gotoAndStop((1 + MuzickaLogika));
MuzickaLogika = (1 - MuzickaLogika);
if (MuzickaLogika == 0){
MuzikaChannel.stop();
} else {
MuzikaChannel = Muzika.play(0, 999);
};
}
private function gasi_instr(_arg1:MouseEvent):void{
delta_instr = (delta_instr * -1);
if (_instr.hasEventListener(Event.ENTER_FRAME) == false){
_instr.addEventListener(Event.ENTER_FRAME, let_instr, false, 0, true);
};
}
function frame52(){
stop();
}
private function dugme_klik(_arg1:myCustomEvent):void{
var _local2:URLRequest;
switch (_arg1.myMessage){
case 1:
trace("Kliknut Start");
i = 0;
while (i < 4) {
_buttonArray[i].removeEventListener("myCustomEvent", dugme_klik);
i++;
};
this.removeEventListener(Event.ENTER_FRAME, button_run);
_instr.removeEventListener(Event.ENTER_FRAME, let_instr);
GameMain.game_state = 2;
dispatchEvent(new promenaStanjaIgre());
break;
case 2:
if (_instr.hasEventListener(Event.ENTER_FRAME) == false){
delta_instr = 30;
_instr.addEventListener(Event.ENTER_FRAME, let_instr, false, 0, true);
};
break;
case 3:
trace("Kliknuto OtherGames");
_local2 = new URLRequest("http://www.10x10games.com");
navigateToURL(_local2, "_blank");
break;
case 4:
trace("Kliknuto SendToFriend");
navigateToURL(zahtev_sendfriend, "_blank");
break;
};
}
private function let_instr(_arg1:Event):void{
_instr.y = (_instr.y - delta_instr);
if ((((_instr.y < 260)) || ((_instr.y >= 550)))){
_instr.removeEventListener(Event.ENTER_FRAME, let_instr);
};
}
}
}//package
Section 24
//maze (maze)
package {
import flash.display.*;
public dynamic class maze extends MovieClip {
public function maze(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame18(){
stop();
}
function frame12(){
stop();
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame19(){
stop();
}
function frame13(){
stop();
}
function frame17(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame16(){
stop();
}
function frame8(){
stop();
}
function frame2(){
stop();
}
function frame15(){
stop();
}
function frame20(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 25
//muzDugme (muzDugme)
package {
import flash.display.*;
public dynamic class muzDugme extends MovieClip {
public var MuzickoDugme:muzDugmeOsnov;
}
}//package
Section 26
//muzDugmeOsnov (muzDugmeOsnov)
package {
import flash.display.*;
public dynamic class muzDugmeOsnov extends MovieClip {
public function muzDugmeOsnov(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 27
//MuzickoDugme (MuzickoDugme)
package {
import flash.display.*;
public dynamic class MuzickoDugme extends SimpleButton {
}
}//package
Section 28
//myButton (myButton)
package {
import flash.display.*;
public dynamic class myButton extends MovieClip {
public var natpis:MovieClip;
}
}//package
Section 29
//myButtonClass (myButtonClass)
package {
import flash.events.*;
import flash.display.*;
public class myButtonClass extends MovieClip {
var my_button_species:int;
var button_smer:Number;
public function myButtonClass(){
var _local1:myButton;
super();
my_button_species = mainMenu.button_species;
_local1 = new myButton();
_local1.natpis.gotoAndStop(my_button_species);
_local1.natpis.mouseEnabled = false;
_local1.addEventListener(MouseEvent.MOUSE_DOWN, klik_dugme, false, 0, true);
addChild(_local1);
}
private function klik_dugme(_arg1:MouseEvent):void{
dispatchEvent(new myCustomEvent(my_button_species));
}
}
}//package
Section 30
//myCustomEvent (myCustomEvent)
package {
import flash.events.*;
public class myCustomEvent extends Event {
public var myMessage:int;
public function myCustomEvent(_arg1:int){
super("myCustomEvent");
myMessage = _arg1;
}
}
}//package
Section 31
//odzivStrelica (odzivStrelica)
package {
import flash.events.*;
public class odzivStrelica extends Event {
public var odzivS:int;
public function odzivStrelica(_arg1:int){
super("odzivStrelica");
odzivS = _arg1;
}
}
}//package
Section 32
//Osnovni_font (Osnovni_font)
package {
import flash.text.*;
public dynamic class Osnovni_font extends Font {
}
}//package
Section 33
//promenaStanjaIgre (promenaStanjaIgre)
package {
import flash.events.*;
public class promenaStanjaIgre extends Event {
public var promenaStatusa:int;
public function promenaStanjaIgre(){
super("promenaStanjaIgre");
}
}
}//package
Section 34
//Ready_for_now (Ready_for_now)
package {
import flash.media.*;
public dynamic class Ready_for_now extends Sound {
}
}//package
Section 35
//strela_2frejm (strela_2frejm)
package {
import flash.display.*;
public dynamic class strela_2frejm extends MovieClip {
public var str_nista:MovieClip;
public var str_dugme:strela_dugme;
}
}//package
Section 36
//strela_dugme (strela_dugme)
package {
import flash.events.*;
import flash.display.*;
public class strela_dugme extends SimpleButton {
var species:int;
public function strela_dugme(){
this.addEventListener(MouseEvent.MOUSE_DOWN, klik_dugme, false, 0, true);
}
private function klik_dugme(_arg1:MouseEvent):void{
dispatchEvent(new odzivStrelica(5));
}
}
}//package
Section 37
//uzvicnik_animat (uzvicnik_animat)
package {
import flash.display.*;
public dynamic class uzvicnik_animat extends MovieClip {
}
}//package