rand = function(r) { return (int)(Math.random() * r); } make_floor = function(y) { f = Floor_top - y; if(f % 5 == 0) { if(f % 250 == 0) { x1 = 16; x2 = WIDTH * 16 - 16; frame = 1; } else { w = (WIDTH - 11); fvec = (rand(2) * 2 - 1) * (rand((int)(w / 4)) + (int)(w / 4)); fpos = ((int)(w / 2) + fvec + w) % w; r1 = rand(3); r2 = rand(3); x1 = (fpos + 5 - r1 - 2) * 16 + 1; x2 = (fpos + 5 + r2 + 3) * 16 + 1; frame = 2 + r1 + r2; // 2 -> 5 // 8 -> 11 } set_floor_l(y, x1); set_floor_r(y, x2); Floor_index++; eval("floor_".concat(Floor_index)).gotoAndStop(frame); // eval("floor_".concat(Floor_index))._width = x2 - x1; eval("floor_".concat(Floor_index))._x = x1; eval("floor_".concat(Floor_index))._y = y * 16; if(Floor_index == 5) Floor_index = 0; return; } else { set_floor_l(y, WIDTH * 16); set_floor_r(y, 0); } } scroll_up = function() { var y; for(y = 0; y < 5; y++) eval("floor_".concat(y + 1))._y += 16; Floor_top++; if(--Map_index < 0) Map_index = HEIGHT - 1; make_floor(0); } get_floor_l = function(y) { return Floor_L[ (y + Map_index) % HEIGHT ]; } get_floor_r = function(y) { return Floor_R[ (y + Map_index) % HEIGHT ]; } set_floor_l = function(y, v) { Floor_L[ (y + Map_index) % HEIGHT ] = v; } set_floor_r = function(y, v) { Floor_R[ (y + Map_index) % HEIGHT ] = v; } Floor_L = new Array(HEIGHT); Floor_R = new Array(HEIGHT); Floor_top = HEIGHT - 4; Map_index = 0; var t = 4; for(y = 0; y < HEIGHT; y++) { if((Floor_top - y) % 5 == 0) Floor_index = t--; make_floor(y); } Floor_index = 0; Score = 0; gameover_label._visible = false; form_label._visible = false;