我正在使用Flash Pro CS6进行游戏,你需要避免掉落的立方体。当你避免使用une cube(cube_1)时,你会得到一个观点。我已经制作了一个scoreCounter texfield并将其设置为动态文本。我不知道如何告诉Flash当影片剪辑“cube_1”的动画完成时,它应该添加一个点,所以我做了一个if语句,取决于立方体的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;
}
}