How to create a timer/counter in C# XNA
问题 I'm fairly new to C# programming, and this is my first time using it in XNA. I'm trying to create a game with a friend, but we're struggling on making a basic counter/clock. What we require is a timer that starts at 1, and every 2 seconds, +1, with a maximum capacity of 50. Any help with the coding would be great! Thanks. 回答1: To create a timer in XNA you could use something like this: int counter = 1; int limit = 50; float countDuration = 2f; //every 2s. float currentTime = 0f; currentTime +