0
您好我正在開發Android上的LibGDX類節奏遊戲。在遊戲中,當「形狀」處於黑色方塊時,您必須單擊特定按鈕。我需要將相機速度與音樂同步。我是以60/61 FPS定時相機速度,但是當幀速下降音樂脫臼時。LibGDX節奏遊戲 - 同步相機的速度與音樂
每個「形狀」具有存儲在currentVelocity變量時「形狀」是接近黑色正方形速度可變。
Move方法:
switch (currentDirection) {
case UP:
camera.position.y += currentVelocity;
for (Actor uiComponent : stage.getActors()) {
if (!(uiComponent instanceof ShapeObject)) {
uiComponent.setY(uiComponent.getY() + currentVelocity);
}
}
break;
case DOWN:
camera.position.y -= currentVelocity;
for (Actor uiComponent : stage.getActors()) {
if (!(uiComponent instanceof ShapeObject)) {
uiComponent.setY(uiComponent.getY() - currentVelocity);
}
}
break;
case RIGHT:
camera.position.x += currentVelocity;
for (Actor uiComponent : stage.getActors()) {
if (!(uiComponent instanceof ShapeObject)) {
uiComponent.setX(uiComponent.getX() + currentVelocity);
}
}
break;
case LEFT:
camera.position.x -= currentVelocity;
for (Actor uiComponent : stage.getActors()) {
if (!(uiComponent instanceof ShapeObject)) {
uiComponent.setX(uiComponent.getX() - currentVelocity);
}
}
break;
}
我知道,你必須用BPM計算的話,但我不知道該怎麼做。爲了分析BPM,我使用了MixMeister BPM分析器。
我迷路了:)謝謝你的回覆。