プラットフォーム x プレーヤーの前の距離を無限に生成しようとしていますが、どこから始めればよいかほとんどわかりません。また、互いの上に「積み重ねる」ことはできません。現在、私が持っているものは以下のとおりです。エラーはありませんが、かなりのメモリを消費し、ゲームがフラッシュcs3をクラッシュさせるまで遅れます
function enterFrameHandler(e:Event):void{
//gravitate the player
_vy += 1.5;
//move the player
Player.x += _vx;
Player.y += _vy;
//process collisions
processCollisions();
//Process other collisions
processOtherCollisions();
//scroll the stage
scrollStage();
//Process Key Presses
KeyHandler();
//Process Lives once
LifeHandler();
//Generate Objects
generateObjects();
}
//Function for generating objects
var ObjectArray:Array = [];
var ChildrenColliding:Boolean = false;
function generateObjects():void{
if(_vx > 0){
var Square:MovieClip;
Square = new mcSquare();
Square.x = Math.random() * 500 + Math.abs(_boundaries.x);
Square.y = Math.random() * stage.stageHeight/2.5 + (stage.stageHeight/2.5);
ObjectArray.push(Square);
_boundaries.addChild(Square);
}
for(var i in ObjectArray){
for(var a in ObjectArray){
if(ObjectArray[a].hitTestObject(ObjectArray[i]) && a != i){
ChildrenColliding = true;
}
}
while(ChildrenColliding){
ObjectArray[i].x = Math.random() * 500 + Math.abs(_boundaries.x);
ObjectArray[i].y = Math.random() * stage.stageHeight/2.5 + (stage.stageHeight/2.5);
}
}
}