I need to record things as accurately as possible in this game I'm making. I've done the basic record/stop recording, but it still lacks the accuracy I need, any ways to improve it?
What it does is you press the key and it starts to record the command it measures how long the key is pressed or not pressed. The cache (probably not the most appropriate name for it) is used to back up what the final number was for future use. The Execute is used to determine weather or not the key was pressed or not:
if (Keyboard.GetState().IsKeyUp(Keys.D))
{
command += 1;
commandCache += 1;
commandExecute = false;
}
Then when your ready to play it this code tests weather its down or not, then if it isn't down it decides how long it wasn't down by taking away from the command int.
if (playback == true)
{
if (commandExecute == false)
{
command -= 1;
}
if (command <= 0) { playback = false; }
}
But for some reason it is not accurate enough as in when it is played back, it doesn't line up exactly were its supposed to. Any suggestions?