立方体の落下を避ける必要がある Flash Pro CS6 でゲームを作成しています。ウネ キューブ (cube_1) を回避すると、ポイントが得られます。私は scoreCounter texfield を作成し、動的テキストのように設定しました。ムービー クリップ「cube_1」のアニメーションが終了したときにポイントを追加する必要があることを Flash に伝える方法がわからなかったので、キューブの Y 座標に応じて (> ステージ Y )、ポイントを獲得します。問題は、私が何のポイントも得られないことです!
コードは次のとおりです。
timer.addEventListener(TimerEvent.TIMER, cubeFall);
function cubeFall(t:TimerEvent) {
time++;
if (time == 3) {
cube_1.play();
} else if (time == 10) {
cube_2.play();
} else if (time == 20) {
cube_3.play();
} else if (time == 30) {
cube_4.play();
} else if (time == 35) {
cube_5.play();
} else if (time == 40) {
cube_6.play();
} else if (time == 50) {
cube_7.play();
} else if (time == 60) {
cube_8.play();
}
// Add Score
else if (cube_1.y > 480 || cube_2.y > 480 || cube_3.y > 480 || cube_4.y > 480 || cube_5.y > 480 || cube_6.y > 480 || cube_7.y > 480 || cube_8.y > 480 ) {
score++;
scoreCounter.text = "Score: " + score;
}
}