rendered paste bodyonClipEvent (load) {
_root.dir = "r";
}
onClipEvent (enterFrame) {
halfway = Stage.width/2;
if (key.isdown(key.RIGHT) && _root.dir != "r") {
setProperty(walk, _xscale, +100);
_root.dir = "r";
} else if (key.isdown(key.LEFT) && _root.dir != "l") {
setProperty(walk, _xscale, -100);
_root.dir = "l";
}
if (key.isdown(key.RIGHT) && _x<halfway) {
trace("move");
_x += 10;
dir = 10;
nextFrame()
//if dir = 1 then direction = right
}
if (key.isdown(key.CONTROL) && (dir == 1) && _x<halfway) {
_x += 5;
//control allows running. fix possibly.
}
if (key.isdown(key.LEFT) && _x>0) {
_x -= 10;
dir = 10;
nextFrame()
//if dir = 2 then direction = left
}
if (key.isdown(key.CONTROL) && (dir == 2)) {
_x -= 5;
//control allows running. fix possibly.
}
if (key.isdown(key.Space)) {
this.gotoAndPlay(5);
//control allows running. fix possibly.
}
if (key.isdown(key.UP) && jump != "y") {
jump = "y";
jumpy = 16;
starty = _y;
_root.mariojump.start();
}
if (Math.Ceil(_root.score) == 100) {
_root.oneup.start();
_root.score = 0;
}
for (i=0; i<_root.koincount; i++) {
if (_root.walk, hitTest(_root.koinArray[i])) {
_root.getcoin.start();
_root.getcoin.setVolume(11);
_root.koinArray[i]._y = 100000000000;
_root.score += 1;
}
}
if (jump == "y") {
_y -= jumpy;
jumpy -= 2;
}
if (_y>starty) {
_y = starty;
jump = "n";
}
if (Math.Ceil(_root.score) == 100) {
_root.oneup.start();
_root.score = 0;
_root.life += 1;
}
if (_x>halfway) {
_root.backgroundd._x -= 3;
for (i=0; i<_root.koincount; i++) {
_root.koinArray[i]._x -= 3;
}
}
}