Feature: musicians jump in time
This commit is contained in:
parent
612a1bf501
commit
09a2dd03bc
@ -224,7 +224,12 @@ export class MedievalMusicians extends SceneFeature {
|
|||||||
mesh.position.y = area.y + musicianHeight / 2;
|
mesh.position.y = area.y + musicianHeight / 2;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.isJumping = true;
|
||||||
musicianObj.jumpHeight = jumpHeight + Math.random() * jumpVariance;
|
musicianObj.jumpHeight = jumpHeight + Math.random() * jumpVariance;
|
||||||
musicianObj.jumpStartTime = time;
|
musicianObj.jumpStartTime = time;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user