Hey there !
here is my game: http://www.geocities.com/dj_zombie02/game.swf no preloaderSize(252 KB)
i want to use SPACE as a jump ..i dont know how to do it and when the stickman get's to the end of that foot path he stays in the air ..i want him to fall heh
here is the script!
// frames:
// -
// straight
// right
// left
// straight-right
// straight-left
// right-run1
// right-run2
// right-run3
//
//
// actions:
// -
// turn-right
// turn-left
// run-right
// run-left
// stop-run
onClipEvent (load) {
frame = "straight";
action = "turn-right";
}
onClipEvent (enterFrame) {
if (action != "none") {
// TURNING
if (action == "turn-right") {
if (frame == "straight-right") {
frame = "right";
action = "none";
} else if (frame == "straight") {
frame = "straight-right";
} else if (frame == "straight-left") {
frame = "straight";
} else if (frame == "left") {
frame = "straight-left";
} else {
action = "none";
}
}
if (action == "turn-left") {
if (frame == "straight-left") {
frame = "left";
action = "none";
} else if (frame == "straight") {
frame = "straight-left";
} else if (frame == "straight-right") {
frame = "straight";
} else if (frame == "right") {
frame = "straight-right";
} else {
action = "none";
}
}
// RUNNING
if (action == "run-right") {
if (frame == "right-run3") {
frame = "right-run2";
this._x += 9;
} else if (frame == "right-run2") {
frame = "right-run3";
this._x += 9;
} else if (frame == "right-run1") {
frame = "right-run2";
this._x += 9;
} else if (frame == "right") {
frame = "right-run1";
this._x += 5;
}
}
if (action == "run-left") {
if (frame == "left-run3") {
frame = "left-run2";
this._x -= 9;
} else if (frame == "left-run2") {
frame = "left-run3";
this._x -= 9;
} else if (frame == "left-run1") {
frame = "left-run2";
this._x -= 9;
} else if (frame == "left") {
frame = "left-run1";
this._x -= 5;
}
}
if (action == "stop-run") {
if (frame == "right-run3") {
frame = "right-run2";
this._x += 9;
} else if (frame == "right-run2") {
frame = "right-run1";
this._x += 5;
} else if (frame == "right-run1") {
frame = "right";
action = "none";
} else if (frame == "left-run3") {
frame = "left-run2";
this._x -= 9;
} else if (frame == "left-run2") {
frame = "left-run1";
this._x -= 5;
} else if (frame == "left-run1") {
frame = "left";
action = "none";
} else {
action = "none";
}
}
this.gotoAndStop(frame);
}
}
onClipEvent (keyDown) {
if (Key.isDown(Key.RIGHT)) {
if (action == "none") {
if (frame == "left") {
action = "turn-right";
}
if (frame == "right") {
action = "run-right";
}
}
if (action == "turn-left") {
action = "turn-right";
}
} else if (Key.isDown(Key.LEFT)) {
if (action == "none") {
if (frame == "right") {
action = "turn-left";
}
if (frame == "left") {
action = "run-left";
}
}
if (action == "turn-right") {
action = "turn-left";
}
}
}
onClipEvent (keyUp) {
if (!Key.isDown(Key.RIGHT)) {
if (action == "run-right") {
action = "stop-run";
}
}
if (!Key.isDown(Key.LEFT)) {
if (action == "run-left") {
action = "stop-run";
}
}
}




Size(252 KB)
Reply With Quote