Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

XNA: How to create a timer using GameTime?

Name: Anonymous 2010-06-16 8:15

[/code]
/--------------------------------------------------------------
/--------------------------DISCLAIMER--------------------------
/This code is in C# using the XNA Framework, if you have no /clue what im talking about, please take your SICP to other /threads, theres a reason im using a greasemonkey scripts to /block the word SICP
/--------------------------------------------------------------
[/code]

So in my pong remake, i want to make a timer to show when to reset the ball after the player scores.

Using GameTime, how would i go about making a timer readable by other code

for example:

Here is when the ball will be reset


while (resetTimer <= 0)
            {
                ballVelocity = new Vector2(10, 10);
            }


This is saying whenever the "resetTimer" reaches 0 seconds, the ball will begin to move again.


I understand that ElapsedGameTime means the amount of time between frames, but is there any way for my "resetTimer" to be subtracted by one every second? (in this case, "resetTimer" is declared an int with the value of 3)

Name: Anonymous 2010-06-16 16:15

>>10
/prog/ hates you more than you hate it. And I don't mean that in a ``/prog/ hates everyone'' sense; I mean you, specifically: the kind of idiot who can't even figure out how to read the documentation and who puffs himself up with self-righteous indignation when it's pointed out to him that he's made some terrible decisions in life.
The posts you denounced are the best advice you can get; not just on /prog/, but in general. The one you liked, quite apart from the risible quality of the code, will only perpetuate your cycle as a copy/paste ``programmer'' incapable of even the slightest bit of independent thought. You aren't capable of recognising genuine helpfulness, because you're an ignorant fool, too self-absorbed to improve.

People like you are a disease, and you're not just contaminating /prog/ with your bullshit; you're killing the whole industry.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List