Sunday, 19 May 2013

Replay on game like "impossible game"

Replay on game like "impossible game"

So I am making a simple game like "the impossible game" where the character just moves forward(from a 2D prespective) and the only thing you have to do is press the screen to jump at the correct time to avoid crashing into obstacles.
My record algorithm is quite simple:
   onJump()
   {
       events.append(player.pos.x);
   }
And my replay is:
   onUpdate()
   {
       if(player.x==events[nextevent])
            player.jump();
   }
Everything works O.K but sometimes in extreme situations(the player jumped just before he crash on an obstacle)while the player didn't actually crash, on replay the player crashes. I know this is happening because of the delta time(different delta on record and on replay). How can I fix it without having the need to record my delta time too?

No comments:

Post a Comment