There are many ways to make this work out, you may want to look at google for "console games" there is one that shows how to make an interestin console type game in flash.
One way that you may want to think about doing things, assuming that you don't have millions of different pieces of terrain on the screen at once (or checking at the same time) would be to add all of them to an array and just loop through them.
CODE
var terrain_array:Array = new Array();
terrain_array.push(_root.terrain);
//and so on...
onClipEvent(enterFrame){
if(_root.go == true){
yspeed = yspeed+gravity;
for(var x:Number = 1; x<precision; x++){
spot_x = _x+radius*Math.sin(x*360/precision);
spot_y = _y-radius*Math.cos(x*360/precision);
doHitCheck(spot_x, spot_y);
}
}
}
function doHitCheck(x:Number, y:Number){
for(var i:Number = 0; i<terrain_array.length; i++){
if(terrain_array[i].hitTest(x, y, true)){
yspeed = 0;
break;
}
}
return;
}
That will check for everything you add into the terrain and see if every check hits it, if it does it will end the loop and continue the checks, other wise it will continue the loop until it finds one that works, or finishes going through the array of movieclips.
However, a better way, is to simply place all the ground that you want in a single movieclip and then to a hitTest against it.
Here is some sample code from a console game out there in one of those tutorials:
CODE
var jumpHeight = -20;
var options = _root.createEmptyMovieClip("opts",101);
var k = _root.createEmptyMovieClip("square", l00);
k.beginFill(0x989cc9);
k.moveTo(0, -5);
kpt = new Array({x:0, y:-5}, {x:0, y:5}, {x:5, y:5}, {x:5, y:-5});
for (var e = 1; e<kpt.length; e++) {
k.lineTo(kpt[e].x, kpt[e].y);
}
sp = 0;
k._y = Stage.height/2;
k._x = Stage.width/2;
pts = new Array({x:23, y:-200}, {x:46, y:-200}, {x:46, y:333}, {x:233, y:333}, {x:290.9, y:273}, {x:480, y:332.4}, {x:620, y:266}, {x:620, y:230}, {x:641, y:230}, {x:641, y:176}, {x:681, y:176}, {x:681, y:250}, {x:740, y:335}, {x:900, y:335}, {x:900, y:-200}, {x:940, y:-200}, {x:940, y:381}, {x:23, y:382}, {x:23, y:-200});
_root.createEmptyMovieClip("plat", -1);
plat.lineStyle(10);
for (var i = 1; i<pts.length; i++) {
plat.moveTo(pts[i-1].x, pts[i-1].y);
plat.lineTo(pts[i].x, pts[i].y);
}
onEnterFrame = function () {
if(plat.hitTest(square._x, square._y, true)){
jumping=false;
}
else{
square._y += 8;
}
while (plat.hitTest(square._x, square._y, true)) {
square._y--;
}
if((!plat.hitTest(square._x+10, square._y-20, true) && sp<-1) || (!plat.hitTest(square._x-10, square._y-20, true) && sp>1)){
plat._x += (sp *= .85);
}
else{
(sp *= .85);
}
if(Key.isDown(Key.UP) && !jumping){
jump=jumpHeight;
jumping=true;
}
else{
null;
}
if(jumping){
if(jump<10){
jump++;
}
else{
jump=10;
}
square._y += jump;
}
else{
null;
}
if(Key.isDown(Key.LEFT)){
sp += .75;
}
else{
null;
}
if(Key.isDown(Key.RIGHT)){
sp--;
}
else{
null;
}
};
They just make a single movieclip and do all their checks agains it for grouund and walls.
Hope that helps.