title: How to increase a variable every second in Pygame?
body: <p>I am creating a clicker game, very similar to cookie clicker. My question is, how do I increase a variable by an amount every second?</p>
  
  <p>Here, prepare for a new game.</p>
  
  <pre><code>def new(self):
      # set cookies/multipliers for a new game
      self.cookie_count = 0
      self.grandma = 10 # grandma bakes 10 cookies/second
  </code></pre>
  
  <p>Then, if a grandma is purchased, add <strong>10 cookies/second</strong> to self.cookie_count for every grandma purchased. Example: If 2 grandmas are purchased, <code>self.cookie_count += 20</code> cookies/second. Yet, as I have it now, everytime I purchase a grandma I just get 10 cookies.</p>
  
  <pre><code>if self.rect2.collidepoint(self.mouse_pos) and self.pressed1:
     self.cookie_count += self.grandma
  </code></pre>
  
  <p>I know that it has something to do with time, but other than that I'm not quite sure where to start. </p>