Hi I am developing LibGDX kind of rhythm game on android. In the game you must click on specific button when "shape" is in black square. I need to synchronize camera speed with music. I was timing camera speed on 60/61 FPS, but when frame rate drop music dislocate.
Each "shape" have velocity variable which is stored in currentVelocity variable when "shape" is close to the black square.
Move method:
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;
}
I know that you must calculate it with BPM, but I have no idea how to do it. To analyze BPM I'm using MixMeister BPM Analyzer.
I'm lost :) Thanks for reply.