Frame 1
stop();
Frame 2
function povorot_palki_za_mishkoi() {
xdiff = _root._xmouse - palka._x;
ydiff = _root._ymouse - palka._y;
angle = Math.atan2(ydiff, xdiff);
angle = (angle * 180) / Math.PI;
palka._rotation = angle;
}
function vistrel() {
if (_root.nomer_puli > 50) {
_root.nomer_puli = 0;
} else {
_root.nomer_puli++;
}
angle = palka._rotation;
angle = (angle * Math.PI) / 180;
pdepth = pdepth + 2;
pula = "boolet" + nomer_puli;
_root.attachMovie("boolet", pula, nomer_puli + glubina_puli);
_root[pula]._x = palka._x + (nose * Math.cos(angle));
_root[pula]._y = palka._y + (nose * Math.sin(angle));
_root[pula].xmov = pspeed * Math.cos(angle);
_root[pula].ymov = pspeed * Math.sin(angle);
}
function peredvijenie_obiektov() {
i = 0;
while (i < 52) {
if ("boolet" + i) {
_root["boolet" + i]._x = _root["boolet" + i]._x + _root["boolet" + i].xmov;
_root["boolet" + i]._y = _root["boolet" + i]._y + _root["boolet" + i].ymov;
}
i++;
}
i = 0;
while (i < 22) {
if ("sharik_" + i) {
_root["sharik_" + i]._x = _root["sharik_" + i]._x + _root["sharik_" + i].xmov;
_root["sharik_" + i]._y = _root["sharik_" + i]._y + _root["sharik_" + i].ymov;
if (_root["sharik_" + i]._y < 0) {
healthbar.text = healthbar.text - 4;
_root["sharik_" + i].removeMovieClip();
_root.sharp._alpha = 40;
}
}
i++;
}
}
function respawn_sharikov_po_kotorim_strelat() {
vremya_mejdu_respawnami = 1;
if (_root.respawn_timer > vremya_mejdu_respawnami) {
_root.respawn_timer = 0;
zarespawnit_sharik();
} else {
framerate = 24;
_root.respawn_timer = _root.respawn_timer + (1 / framerate);
}
}
function zarespawnit_sharik() {
if (_root.nomer_sharika > 20) {
_root.nomer_sharika = 0;
} else {
_root.nomer_sharika++;
}
kuda_lojit_sharik_po_ixu = random(400);
kuda_lojit_sharik_po_igriku = 500;
_root.attachMovie("spawn", "sharik_" + _root.nomer_sharika, _root.nomer_sharika + glubina_sharika);
novii_sharik = "sharik_" + _root.nomer_sharika;
_root[novii_sharik]._x = kuda_lojit_sharik_po_ixu;
_root[novii_sharik]._y = kuda_lojit_sharik_po_igriku;
_root[novii_sharik].xmov = 0;
_root[novii_sharik].ymov = skorost_sharika;
}
function Proverka_Na_Stolkbovenie() {
i = 0;
while (i < 52) {
item_1 = _root["boolet" + i];
if (item_1) {
j = 0;
while (j < 22) {
item_2 = _root["sharik_" + j];
if (item_2) {
calc12312 = CALC_Dist_Xv_Yv(item_2._x, item_2._y, item_1._x, item_1._y);
distance = calc12312[0];
if (distance < na_kakom_rasstoyanii_zadshitivat_stolknovenie) {
if (_root.nomer_chpoka > 50) {
_root.nomer_chpoka = 0;
} else {
_root.nomer_chpoka++;
}
_root.attachMovie("chpok", "chpok_" + _root.nomer_chpoka, _root.nomer_chpoka + glubina_chpoka);
scorebar.text = parseInt(scorebar.text);
score = score + 10;
scorebar.text = null;
scorebar.text = score;
_root["chpok_" + _root.nomer_chpoka]._x = item_2._x;
_root["chpok_" + _root.nomer_chpoka]._y = item_2._y;
removeMovieClip(item_2);
removeMovieClip(item_1);
}
}
j++;
}
}
i++;
}
}
function CALC_Dist_Xv_Yv(x1, y1, x2, y2) {
A = {};
B = {};
A.xx = x1;
A.yy = y1;
B.xx = x2;
B.yy = y2;
dx = A.xx - B.xx;
dy = A.yy - B.yy;
distance = Math.sqrt((dx * dx) + (dy * dy));
return([distance, x_modifier, y_modifier, dx, dy]);
}
skorost_sharika = -5;
pspeed = 8;
na_kakom_rasstoyanii_zadshitivat_stolknovenie = 15;
glubina_puli = 800;
glubina_sharika = 100;
glubina_chpoka = 50000;
nose = 60;
nomer_puli = 0;
nomer_sharika = 0;
nomer_chpoka = 0;
respawn_timer = 0;
score = 0;
stop();
onMouseMove = function () {
povorot_palki_za_mishkoi();
};
onMouseDown = function () {
vistrel();
};
onEnterFrame = function () {
peredvijenie_obiektov();
respawn_sharikov_po_kotorim_strelat();
Proverka_Na_Stolkbovenie();
};
Symbol 11 MovieClip [chpok] Frame 16
removeMovieClip(this);
Symbol 24 Button
on (press) {
stopAllSounds();
gotoAndStop (2);
}
Instance of Symbol 32 MovieClip in Symbol 33 MovieClip Frame 1
onClipEvent (load) {
timeA = 0;
median_fps_sum = 0;
median_fps_mod = 5;
median_fps_count = 0;
median_fps_sum2 = 0;
median_fps_mod2 = 25;
median_fps_count2 = 0;
}
onClipEvent (enterFrame) {
timeB = getTimer();
var fps_rough = Math.floor(1000 / (this.timeB - this.timeA));
timeA = timeB;
if (median_fps_count < median_fps_mod) {
median_fps_count++;
median_fps_sum = median_fps_sum + fps_rough;
} else {
this.current_fps = Math.floor(median_fps_sum / this.median_fps_count);
this.median_fps_sum = 0;
this.median_fps_count = 0;
}
if (median_fps_count2 < median_fps_mod2) {
median_fps_count2++;
median_fps_sum2 = median_fps_sum2 + fps_rough;
} else {
this.current_fps2 = Math.floor(median_fps_sum2 / this.median_fps_count2);
this.median_fps_sum2 = 0;
this.median_fps_count2 = 0;
}
if (current_fps > 30) {
current_fps = "--";
}
showvar = current_fps;
}