0
내 배열의 항목이 y 축을 따라 스테이지 아래로 이동하지 않는 이유를 이해할 수 없으므로 x에서 무작위로 나타납니다. 여기 내 코드가 있습니다 :장애물 이동
import flash.display.MovieClip;
import flash.events.Event;
import fl.transitions.Tween;
import fl.transitions.easing.*;
public class obstacleOne extends MovieClip {
private var speed:Number;
private var obstacleOneTypes:Array = ["obstacle1","obstacle2"];
private var thisObstacleOneType:String;
public function obstacleOne() {
// constructor code
// pick a random number between 1 and the amount of types of litter
var randomNumber:uint = Math.ceil(Math.random() * obstacleOneTypes.length);
thisObstacleOneType = obstacleOneTypes[randomNumber - 1];
this.gotoAndStop(randomNumber);
this.x = Math.ceil(Math.random() * 400);
this.y =0 - Math.random()*400;
speed = 4 + (Math.random()*4)
addEventListener(Event.ENTER_FRAME,updateMe);
}
public function caught():void{
// in this function are going to animate the litter removing from the screen using a tween equation
// when it is finished we can remove the object
// now place in a random position on the beach
this.x = Math.ceil(Math.random() * stage.stageWidth);
this.y =0 - Math.random()*2000;
}
private function updateMe(evt:Event):void{
this.y += speed;
if(y>stage.stageHeight){
this.y = 7;
// send an event to main class to subtract score
//stage.dispatchEvent(new Event("hitBottom",true));
}//*/
}
대신 무엇이 발생하고 있습니까? – pkyeck
문제에 대한 해결책을 찾은 경우 같은 문제가있는 다른 사람들이이 문제를 해결할 수 있도록 여기에 제공하십시오. 고마워. – Sbhklr