Feature: musicians jump in time

This commit is contained in:
Dejvino 2025-11-22 06:27:06 +01:00
parent 612a1bf501
commit 09a2dd03bc

View File

@ -224,7 +224,12 @@ export class MedievalMusicians extends SceneFeature {
mesh.position.y = area.y + musicianHeight / 2;
}
} else {
if (Math.random() < jumpChance && musicianObj.state !== 'JUMPING_PLANE' && musicianObj.state !== 'PREPARING_JUMP') {
let currentJumpChance = jumpChance * deltaTime; // Base chance over time
if (state.music && state.music.beatIntensity > 0.8) {
currentJumpChance = 0.1; // High, fixed chance on the beat
}
if (Math.random() < currentJumpChance && musicianObj.state !== 'JUMPING_PLANE' && musicianObj.state !== 'PREPARING_JUMP') {
musicianObj.isJumping = true;
musicianObj.jumpHeight = jumpHeight + Math.random() * jumpVariance;
musicianObj.jumpStartTime = time;