title: How to add value to an existing variable, over time in Visual Basic
body: <p>For my AS level, I'm required to make a small game. What I'm trying to do is do a game similar to Cookie Clicker (<a href="http://orteil.dashnet.org/cookieclicker/" rel="nofollow">http://orteil.dashnet.org/cookieclicker/</a>).</p>
  
  <p>The problem that I gave is once an item is bought (that is meant to produce more muffins), I don't know how to make it add value to an existing variable(muffin in this case) over time. </p>
  
  <p>This is the first chunk of my code:</p>
  
  <pre><code>Public Class Form1
  Dim muffin As Integer
  
  Private Property costgrandma As Integer
  Private Property grandma As Integer
  
  
  Private Sub Makemuffin_Click(sender As Object, e As EventArgs) Handles Button1.Click
      muffin += 1
      LblMuffinCount.Text = muffin
  
  End Sub
  
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      muffin = 0
      costgrandma = 20
      grandma = 0
  
  End Sub
  
  Private Sub CmdGrandma_Click(sender As Object, e As EventArgs) Handles CmdGrandma.Click
  
      If muffin &gt;= costgrandma Then
          grandma += 1
          LblGrandmaCount.Text = grandma
          muffin = muffin - costgrandma
          LblMuffinCount.Text = muffin
          costgrandma = costgrandma * 1.05
          LblGrandma.Text = costgrandma
  
      Else
          MsgBox("Not enough muffins to pay grandma off")
  
      End If
  End Sub
  </code></pre>
  
  <p>What I want to do is make a sub that adds a number of 'muffins' over time based on how many grandmas there are. 
  For example, if you own 1 grandma, it creates another muffin automatically every second. and if there were 10 grandmas, 10 muffins would be made every second automatically.</p>