Frame 1
gotoAndStop (1);
var enemiespresent = 0;
back.onEnterFrame = function () {
if (Key.isDown(39)) {
back._x = back._x - 20;
}
if (back._x < 200) {
back._x = 600;
}
if (enemiespresent == 0) {
var _local3 = "enemy" + i;
attachMovie("enemy", _local3, i);
_root[_local3]._x = 1200;
_root[_local3]._y = (Math.random() * 180) + 30;
_root[_local3].xmov = (Math.random() * 20) + 5;
_root[_local3].onEnterFrame = function () {
this._x = this._x - this.xmov;
if (this.hitTest(sanic)) {
gotoAndStop (2);
}
if (this._x < 0) {
enemiespresent = 0;
}
};
enemiespresent = 1;
}
};
var grav = 8;
var sanicduk = (sanic._y + 80);
var sanicunduk = 0;
var sanicjump = 0;
var sanicthrust = 0;
sanic.onEnterFrame = function () {
if (Key.isDown(39) and (sanic._x < 500)) {
sanic._x = sanic._x + 2;
}
if (Key.isDown(37) and (sanic._x > 0)) {
sanic._x = sanic._x - 22;
}
if (Key.isDown(40)) {
sanic._height = 40;
sanic._y = sanicduk;
sanicunduk = 0;
} else if (sanicunduk == 0) {
sanic._y = sanic._y - 80;
sanic._height = 80;
sanicunduk = 1;
}
if (Key.isDown(38) and (sanicjump == 0)) {
sanicthrust = 40;
sanicjump = 1;
}
if (sanicthrust < 0) {
sanicthrust = 0;
}
sanic._y = sanic._y - sanicthrust;
sanicthrust = sanicthrust - 2;
if (sanic._y < 300) {
sanic._y = sanic._y + grav;
}
if (sanic._y > 300) {
sanicjump = 0;
}
};
shado.onEnterFrame = function () {
shado._x = shado._x - 20;
if (shado._x < 0) {
shado._x = (Math.random() * 1000) + 1000;
}
if (shado.hitTest(sanic)) {
gotoAndStop (2);
}
};