T
trebor777
Hi!
I'm searching for a light method for finding the closest items to a given
value.
example/
1..10
in a range
i give, 5.5, return 5 and 6 for example....
as i'm working with arrays, containing numbers, but with no regular step...
it will change i think.
example..
a = [ 1, 1.25, 2, 3, 3.5 ]
if i give 1.85, it gives me 1.25 and 2
It's for a little music game, where player has to tap at the right moment,
notes are register in a array, with the correct time, and as players can't
be accurate as a computer, i need some error margin. I working with 0.05
rounded values.
Also, if someone knows a good way to synchro Scrolling and Music with tempo
value that would be great...
I mean, not the conversion to find how many frames between each beats. but
how to convert, the number of frames between 2 beat to a distance in
pixel...? ( and possibly with a set-able speed) ?
Thanks.
I'm searching for a light method for finding the closest items to a given
value.
example/
1..10
in a range
i give, 5.5, return 5 and 6 for example....
as i'm working with arrays, containing numbers, but with no regular step...
it will change i think.
example..
a = [ 1, 1.25, 2, 3, 3.5 ]
if i give 1.85, it gives me 1.25 and 2
It's for a little music game, where player has to tap at the right moment,
notes are register in a array, with the correct time, and as players can't
be accurate as a computer, i need some error margin. I working with 0.05
rounded values.
Also, if someone knows a good way to synchro Scrolling and Music with tempo
value that would be great...
I mean, not the conversion to find how many frames between each beats. but
how to convert, the number of frames between 2 beat to a distance in
pixel...? ( and possibly with a set-able speed) ?
Thanks.