Frame 1
_root.onLoad = function () {
Stage.showMenu = false;
Mouse.hide();
ymov = 4.5;
xmov = 4.5;
stop();
enemyx = 3;
enemyy = 3;
_root.playerscore = 0;
_root.enemyscore = 0;
};
_root.onEnterFrame = function () {
_root.block._x = _root.block._x + xmov;
_root.block._y = _root.block._y + ymov;
if (_root.block.hitTest(_root.wall)) {
xmov = xmov * -1;
ymov = ymov * 1;
}
if (Key.isDown(40)) {
_root.wall._y = _root.wall._y + 5;
} else if (Key.isDown(38)) {
_root.wall._y = _root.wall._y - 5;
}
if (_root.block.hitTest(_root.bottom)) {
xmov = xmov * 1;
ymov = ymov * -1;
}
if (_root.block.hitTest(_root.top)) {
xmov = xmov * 1;
ymov = ymov * -1;
}
if (_root.block.hitTest(_root.left)) {
xmov = xmov * -1;
ymov = ymov * 1;
}
if (_root.block._y > _root.left._y) {
_root.left._y = _root.left._y + enemyy;
}
if (_root.block._y < _root.left._y) {
_root.left._y = _root.left._y - enemyy;
}
if (_root.wall.hitTest(_root.bottom)) {
_root.wall._y = _root.wall._y - 5;
}
if (_root.wall.hitTest(_root.top)) {
_root.wall._y = _root.wall._y + 5;
}
if (_root.left.hitTest(_root.bottom)) {
_root.left._y = _root.left._y - 4;
}
if (_root.left.hitTest(_root.top)) {
_root.left._y = _root.left._y + 4;
}
if (_root.block.hitTest(_root.score1)) {
_root.enemyscore = _root.enemyscore + 1;
_root.block._x = 249.7;
_root.block._y = 187.7;
_root.block._x = _root.block._x - xmov;
}
if (_root.block.hitTest(_root.score2)) {
_root.playerscore = _root.playerscore + 1;
_root.block._x = 249.7;
_root.block._y = 187.7;
_root.block._x = _root.block._x + xmov;
}
};