Instance of Symbol 30 MovieClip [me] "Enemy" in Frame 1
onClipEvent (enterFrame) {
if (((_root.Player.dead == false) & (_root.Player._x >= (_x - 50))) & (!animationPlaying)) {
gotoAndPlay ("Stab");
}
}
on (press) {
gotoAndPlay ("Boom");
}
Instance of Symbol 50 MovieClip "Player" in Frame 1
onClipEvent (load) {
function Jump() {
YSpeed = YSpeed + 2;
if (YSpeed >= 0) {
Jumping = false;
Falling = true;
}
}
function Fall() {
YSpeed = YSpeed + 2;
if (YSpeed > maxSpeed) {
YSpeed = maxSpeed;
}
if (_y > Ground) {
_y = Ground;
Falling = false;
TouchingGround = true;
}
}
keysDown = false;
Jumping = false;
Falling = false;
Running = false;
TouchingGround = true;
AnimationPlaying = false;
Animation = "Idle";
Facing = "LEFT";
maxSpeed = 30;
XSpeed = 0;
YSpeed = 0;
MoveSpeed = 15;
JumpWait = -1;
dead = false;
PlayedJump = false;
Attacking = false;
Ground = _y;
stop();
}
on (keyPress "<Space>") {
if ((!dead) && (!Attacking)) {
Attacking = true;
gotoAndPlay ("Punch");
}
}
onClipEvent (enterFrame) {
keysDown = false;
if ((((!dead) && (Key.isDown(37))) && (!Jumping)) && (!Falling)) {
if (((((!AnimationPlaying) || (Animation != "Run")) && (!Jumping)) && (!Falling)) && (!Attacking)) {
gotoAndPlay ("Run");
}
if (Facing == "RIGHT") {
_xscale = (_xscale * -1);
Facing = "LEFT";
}
XSpeed = -MoveSpeed;
keysDown = true;
}
if ((((!dead) && (Key.isDown(39))) && (!Jumping)) && (!Falling)) {
if (((((!AnimationPlaying) || (Animation != "Run")) && (!Jumping)) && (!Falling)) && (!Attacking)) {
gotoAndPlay ("Run");
}
if (Facing == "LEFT") {
_xscale = (_xscale * -1);
Facing = "RIGHT";
}
XSpeed = MoveSpeed;
keysDown = true;
}
if ((((!dead) && (Key.isDown(38))) && (!Falling)) && (!Jumping)) {
JumpWait = 2;
Jumped = false;
}
if ((!dead) && (!Jumped)) {
gotoAndPlay ("Jumping");
Jumped = true;
Jumping = true;
TouchingGround = false;
YSpeed = -20;
}
_x = (_x + XSpeed);
_y = (_y + YSpeed);
if ((!dead) && (Jumping)) {
Jump();
}
if ((!dead) && (Falling)) {
Fall();
}
if (_y >= Ground) {
TouchingGround = true;
Falling = false;
_y = Ground;
}
if (((!keysDown) && (!Jumping)) && (!Falling)) {
XSpeed = XSpeed * 0.75;
if (Math.abs(XSpeed) <= 1) {
XSpeed = 0;
}
if (((!dead) && ((!AnimationPlaying) || (Animation != "Idle"))) && (!Attacking)) {
gotoAndPlay ("Idle");
AnimationPlaying = true;
}
}
if (_x >= (_root.Enemy._x - 50)) {
_x = (_root.Enemy._x - 50);
XSpeed = 0;
}
if (_x <= 0) {
_x = 0;
XSpeed = 0;
}
}
Symbol 30 MovieClip [me] Frame 1
animationPlaying = false;
Symbol 30 MovieClip [me] Frame 5
gotoAndPlay ("Idle");
Symbol 30 MovieClip [me] Frame 6
animationPlaying = true;
Symbol 30 MovieClip [me] Frame 10
_root.Player.dead = true;
_root.Player.gotoAndPlay("Dead");
Symbol 30 MovieClip [me] Frame 31
stop();
Symbol 50 MovieClip Frame 1
AnimationPlaying = true;
Animation = "Idle";
Attacking = false;
Symbol 50 MovieClip Frame 5
AnimationPlaying = false;
gotoAndPlay ("Idle");
Symbol 50 MovieClip Frame 6
AnimationPlaying = true;
Animation = "Run";
Attacking = false;
Symbol 50 MovieClip Frame 10
AnimationPlaying = false;
gotoAndPlay ("Run");
Symbol 50 MovieClip Frame 11
AnimationPlaying = true;
Animation = "Jumping";
Attacking = false;
Symbol 50 MovieClip Frame 17
AnimationPlaying = false;
gotoAndPlay ("Idle");
Symbol 50 MovieClip Frame 18
AnimationPlaying = true;
Animation = "Punch";
Symbol 50 MovieClip Frame 21
Attacking = false;
gotoAndPlay ("Idle");
Symbol 50 MovieClip Frame 22
AnimationPlaying = true;
Animation = "Dead";
Symbol 50 MovieClip Frame 27
stop();