Jump to content
  • Advertisement
Sign in to follow this  
watermelonChris

Programming a Reaction Time

This topic is 2528 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Based on the player's cordinates on screen I'm adjusting a 'angle'... However I'd like to it be 1 second or so behind the actual cordinates..

I'm using XNA so the game run's at 60 fps, I was thinking of creating a counter of creating an array of 60 elements

And on each frame
> downshift all elements
>add the current cordinate to the first element
>process the last element

Any other ideas?

Share this post


Link to post
Share on other sites
Advertisement

Based on the player's cordinates on screen I'm adjusting a 'angle'... However I'd like to it be 1 second or so behind the actual cordinates..

I'm using XNA so the game run's at 60 fps, I was thinking of creating a counter of creating an array of 60 elements

And on each frame
> downshift all elements
>add the current cordinate to the first element
>process the last element

Any other ideas?


Implementing a ring buffer (i.e. circular queue) would be much more efficient than shifting.

Share this post


Link to post
Share on other sites
For future reference: I got it working like this.


if (timerCountGame >= 60)
{
enemyBullet[0] = new Rectangle(
Convert.ToInt32(playerPositionHistory[0].X)
,Convert.ToInt32(playerPositionHistory[0].Y)
, 80, 80);

playerPositionHistory.RemoveAt(0);

}

playerPositionHistory.Add(new Vector2(player1Rec.X, player1Rec.Y));


The timer is just there as a 'warmup' but it also effects the 'reaction time' since there are 60 updates a second theres a 1 second reaction time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!