Frame 1
function Initialize() {
rick_mc.step = 15;
rick_mc.attack = false;
rick_mc.stance = 1;
rick_mc.crouch = false;
keydown = false;
rick_mc.uvel = 40;
rick_mc.gravity = 6;
rick_mc.jump = false;
}
function Jump() {
if (Key.isDown(37)) {
rick_mc.stance = 0;
rick_mc._x = rick_mc._x - rick_mc.step;
} else if (Key.isDown(39)) {
rick_mc.stance = 1;
rick_mc._x = rick_mc._x + rick_mc.step;
}
if (!rick_mc.attack) {
if (Key.isDown(40)) {
rick_mc.gotoAndStop("crouch");
rick_mc.crouch = true;
} else if (!Key.isDown()) {
rick_mc.gotoAndStop("jump");
rick_mc.crouch = false;
}
}
if (Key.isDown(17) && (keydown == false)) {
rick_mc.attack = true;
}
rick_mc._y = rick_mc._y - rick_mc.uvel;
rick_mc.uvel = rick_mc.uvel - rick_mc.gravity;
if ((rick_mc._y + 20) > (ground_mc._y + 65)) {
rick_mc.jump = false;
rick_mc._y = ground_mc._y + 65;
rick_mc.uvel = 40;
}
}
function Movement() {
if (Key.isDown(39)) {
rick_mc.stance = 1;
rick_mc._x = rick_mc._x + rick_mc.step;
rick_mc.gotoAndStop("walk");
} else if (Key.isDown(37)) {
rick_mc.stance = 0;
rick_mc._x = rick_mc._x - rick_mc.step;
rick_mc.gotoAndStop("walk");
} else if (Key.isDown(40)) {
rick_mc.gotoAndStop("crouch");
rick_mc.crouch = true;
} else if (!Key.isDown()) {
rick_mc.gotoAndStop("stance");
rick_mc.crouch = false;
}
if (Key.isDown(38)) {
rick_mc.gotoAndStop("jump");
rick_mc.jump = true;
}
if (Key.isDown(17) && (keydown == false)) {
rick_mc.attack = true;
}
}
function Attack() {
if (rick_mc.jump) {
rick_mc.gotoAndStop("crouchkick");
} else if (Key.isDown(40)) {
rick_mc.gotoAndStop("crouchkick");
} else {
rick_mc.gotoAndStop("punch");
}
}
function AIZombie() {
if (this.alive) {
this.gotoAndStop("walk");
if (rick_mc._x <= (this._x - 20)) {
this._xscale = 100;
this._x = this._x - this.speed;
} else if (rick_mc._x >= (this._x + 20)) {
this._x = this._x + this.speed;
this._xscale = -100;
}
} else {
this.gotoAndStop("dead");
}
}
function RenderEnemy() {
counter = 0;
while (counter < MonstersInScene.length) {
MonstersInScene[counter].gotoFunction();
if (rick_mc.attack) {
if (rick_mc.hitTest(MonstersInScene[counter])) {
MonstersInScene[counter].alive = false;
}
}
if (MonstersInScene[counter]._x == null) {
MonstersInScene.splice(counter, 1);
SpawnEnemy();
}
counter++;
}
}
MonstersInScene = new Array();
tag = 0;
SpawnEnemy = function () {
attachedObj = _root.attachMovie("zombie", "brownzombie" + tag, tag, {_x:600, _y:205});
attachedObj.health = 100;
attachedObj.speed = 5;
attachedObj.hit = false;
attachedObj.alive = true;
attachedObj.gotoFunction = AIZombie;
MonstersInScene.push(attachedObj);
tag++;
};
SpawnEnemy();
Initialize();
rick_mc.swapDepths(60000);
onEnterFrame = function () {
RenderEnemy();
if ((!rick_mc.attack) && (!rick_mc.jump)) {
Movement();
}
if (rick_mc.jump) {
Jump();
}
if (rick_mc.attack) {
Attack();
}
if (Key.isDown(17)) {
keydown = true;
} else {
keydown = false;
}
if (rick_mc.stance == 0) {
rick_mc._xscale = -100;
} else {
rick_mc._xscale = 100;
}
};
Symbol 14 MovieClip Frame 8
removeMovieClip(_parent);
Symbol 15 MovieClip [zombie] Frame 1
stop();
Symbol 15 MovieClip [zombie] Frame 2
stop();
Symbol 34 MovieClip Frame 4
_parent.attack = false;
Symbol 41 MovieClip Frame 4
_parent.attack = false;
if (_parent.jump) {
stop();
}
Symbol 46 MovieClip Frame 14
stop();
Symbol 47 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 2
stop();
Symbol 47 MovieClip Frame 3
stop();
Symbol 47 MovieClip Frame 4
stop();
Symbol 47 MovieClip Frame 5
stop();
Symbol 47 MovieClip Frame 6
stop();