[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (0.98 KiB)
onLoad = function () {
var _local2 = new ContextMenu();
_local2.hideBuiltInItems();
crazy = function () {
i = 0;
while (i < zombies.length) {
removeMovieClip(zombies[i]);
i++;
}
zombies.splice(1, zombies.length - 1);
};
_root.menu = _local2;
_level0.zom.urname = "_level0.zom";
zombies = new Array(1);
zombies[0] = "_level0.zom";
_level0.zom.nzom = 0;
zomn = 1;
grounds = new Array(6);
grounds[0] = "_level0.gd1";
grounds[1] = "_level0.gd2";
grounds[2] = "_level0.gd3";
grounds[3] = "_level0.gd4";
grounds[4] = "_level0.gd5";
grounds[5] = "_level0.gd6";
};
onEnterFrame = function () {
if (Key.isDown(16)) {
crazy();
}
if (Key.isDown(32)) {
zombies.push("_level0.zom" + zomn);
_level0.zom.duplicateMovieClip("zom" + zomn, zomn, {urname:"_level0.zom" + zomn, _width:random(40) + 10, _height:random(60) + 10, _rotation:random(360), _x:random(200), _y:random(100)});
_level0["zom" + zomn].nzom = zomn;
zomn = zomn + 1;
}
};
Instance of Symbol 4 MovieClip "main" in Frame 1 (1.25 KiB) ●
onClipEvent (load) {
fric = 0;
grav = 0;
movexy = function () {
if (drx == true) {
this._x = this._x + dx;
} else {
this._y = this._y + dx;
}
good = true;
i = 0;
while (i < _root.grounds.length) {
if (this.hitTest(_root.grounds[i]) == true) {
good = false;
}
i++;
}
i = 0;
while (i < _root.zombies.length) {
if (this.hitTest(_root.zombies[i]) == true) {
good = false;
}
i++;
}
if (good == false) {
if (drx == true) {
this._x = this._x - dx;
} else {
this._y = this._y - dx;
}
}
};
}
onClipEvent (enterFrame) {
if (Key.isDown(38)) {
grav = grav - 2;
}
grav = grav + 1;
drx = false;
dx = grav;
movexy();
if (good == false) {
if (grav > 0) {
a = 1;
j = 0;
while (j < a) {
if (good == false) {
a = a + 1;
grav = grav - 1;
drx = false;
dx = grav;
movexy();
}
j++;
}
} else {
grav = 0;
}
}
drx = true;
dx = fric;
movexy();
if (Key.isDown(37)) {
fric = -5;
} else if (Key.isDown(39)) {
fric = 5;
} else {
_y = (_y + 5);
i = 0;
while (i < _root.grounds.length) {
if (hitTest(_root.grounds[i]) == true) {
fric = fric * 0.15;
} else {
fric = fric * 0.95;
}
i++;
}
_y = (_y - 5);
}
}
Instance of Symbol 6 MovieClip "zom" in Frame 1 (1.67 KiB) ●
onClipEvent (load) {
a = 0;
j = 0;
while (j < 1) {
good = true;
i = 0;
while (i < _root.zombies.length) {
if (_root.zombies[i] != urname) {
if (hitTest(_root.zombies[i]) == true) {
good = false;
}
}
i++;
}
if (good == false) {
_x = random(200);
_y = random(100);
a = a + 1;
if (a < 20) {
j = j - 1;
}
}
j++;
}
grav = 0;
movespeed = 1 + random(4);
movexy = function () {
if (drx == true) {
this._x = this._x + dx;
} else {
this._y = this._y + dx;
}
good = true;
i = 0;
while (i < _root.grounds.length) {
if (this.hitTest(_root.grounds[i]) == true) {
good = false;
}
i++;
}
i = 0;
while (i < _root.zombies.length) {
if (_root.zombies[i] != urname) {
if (hitTest(_root.zombies[i]) == true) {
good = false;
}
}
i++;
}
if (hitTest(_root.main) == true) {
good = false;
}
if (good == false) {
if (drx == true) {
this._x = this._x - dx;
} else {
this._y = this._y - dx;
}
}
};
}
onClipEvent (enterFrame) {
grav = grav + 1;
drx = false;
dx = grav;
movexy();
if (good == false) {
if (grav > 0) {
a = 1;
j = 0;
while (j < a) {
if (good == false) {
a = a + 1;
grav = grav - 1;
drx = false;
dx = grav;
movexy();
}
j++;
}
} else {
grav = 0;
}
}
if (_level0.main._x > _x) {
drx = true;
dx = movespeed;
movexy();
}
if (_level0.main._x < _x) {
drx = true;
dx = -movespeed;
movexy();
}
if (_y > 700) {
i = 0;
while (i < _root.zombies.length) {
if (urname == _root.zombies[i]) {
_root.zombies.splice(i, 1);
}
i++;
}
removeMovieClip(urname);
}
}