For the top down shooter part, I can't get the AS right.
The enemy MC has 5 parts seperated by stop();
Following, Attacking, Hit 1,Hit2,Death.
I want it so when the bullet MC hits the Enemy MC while its in following, it goes to Hit 1. It stays at the end of hit 1, and the enemy begins following again. Then, when the enemy MC is on frame 30 or something (The end of hit one) I want it so when he gets shot again it goes to hit2. And at the end of hit2 , he starts following you again. But it stays at the end of hit2. Then, when he's shot again, it goes to Death. And the enemy MC dies.
That's what I want to happen. I did it like that because I don't know any other way to give it "Health" and, since it's a zombie game, when the enemy attacks his health is replenished.
Actions in the "Actions" frame,
Enemy Script
stop();
Num = 0;
hero.onEnterFrame = function() {
if(Key.isDown(Key.LEFT) || Key.isDown(65)){
this._x-=2;
}
if(Key.isDown(Key.RIGHT) || Key.isDown(68)){
this._x+=2;
}
if(Key.isDown(Key.UP) || Key.isDown(87)){
this._y-=2;
}
if(Key.isDown(Key.DOWN) || Key.isDown(83)){
this._y+=2;
}
var x:Number = _xmouse-this._x;
var y:Number = _ymouse-this._y;
var angleRad:Number = Math.atan2(y, x);
var angleDeg:Number = angleRad/Math.PI*180;
this._rotation = angleDeg;
};
Shootbullet = function () {
var bullet = _root.attachMovie("bullet", "bullet"+Num, _root.getNextHighestDepth());
var point = {x:this.hero.gunTip._x,y:this.hero.gunTip._y};
this.hero.localToGlobal(point);
bullet._x = point.x;
bullet._y = point.y;
bullet._rotation = _root.hero._rotation;
bullet.onEnterFrame = function() {
bullet._x += Math.cos(bullet._rotation*(Math.PI/180))*150;
bullet._y += Math.sin(bullet._rotation*(Math.PI/180))*150;
};
Num++;
};
hero.onMouseDown = function() {
Shootbullet();
};
stop();
_root.hero.stop();
onMouseDown = function() {
_root.hero.play();
}
onClipEvent (enterFrame) {
if (_root.hero._y<_y) {
this._y -= 1;
}
if (_root.hero._y>_y) {
this._y += 1;
}
if (_root.hero._x>_x) {
this._x += 1;
}
if (_root.hero._x<_x) {
this._x -= 1;
}
}