python - Trying to add a timer to my game -


This is a very simple question, and I do not know why I could not find the answer, but what does

  texta = font.render ("Time:" Anyone knows how to add timer correctly to pygame for Python 3.4.1?  

+ String ( Time), True, Black) screen. Bleet (Text, [500,100]) I have read the solution using Loop and many other people, but no one is working till now. I want a timer to appear on the screen and count how many seconds the user takes to do a certain job.

Here is a timer you can use

  import Import from pygame, sys Pygame.locals * clock = pygame.time.Clock () time = 0 #GameLoop is correct in seconds, while: milli = clock.tick () # clock.tick () since last time How many milliseconds is said to have passed, it tells you how long it took in loop seconds = ml / 1000 seconds. Time + = seconds print time # then you can see that it works  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -