code:
var tileW = 100;
function buildTerrain() {
_root.attachMovie("empty", "world", 1);
_root.world._y = 0;
_root.world._x = 0;
for (var i = 0; i<6; i++) {
var thename = "t_"+i;
_root.world.attachMovie("terrain", thename, i+1);
_root.world[thename]._y = 350;
_root.world[thename]._x = i*tileW;
var type = math.floor(math.random()*10);
_root.world[thename].gotoAndStop(type);
//trace(type);
_root.world[thename].onEnterFrame = function() {
this._x -= 5;
if (this._x<=-100) {
this._x += 600;
var type = math.floor(math.random()*10);
this.gotoAndStop(type);
}
};
}
}
buildTerrain();
_root.world.onEnterFrame=function(){
_root.world._x-=_root.world.speed
if (_root.world.hitTest(_root.chopper._x,_root.choppe r._y,true)){
_root.world.speed = 0 }}