Post

 Resources 

Console

Fart Sniffer


Part 7 - Fart Decay


The DecayFarts method process each scent in the scene and callís itís Decay method. It then checks to see if the strength of the scent is less or equal to zero if it is then it removes it from the collection, otherwise it moves on to check the next scent in the collection.
The Decay method checks to see if it is time for the scent to decay and if so reduces the scent strength by the DecayRate.

Copy and paste the fallowing code into Form1

  1. Public Sub DecayFarts()
  2.    Dim idx As Integer
  3.    While idx <= mobjScents.Count - 1
  4.       mobjScents(idx).Decay()
  5.       If mobjScents(idx).Strength <= 0 Then
  6.             mobjScents.RemoveAt(idx)
  7.       Else
  8.             idx += 1
  9.       End If
  10.    End While
  11. End Sub




Next: Part 8 - Methane production | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

Post a Comment


Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 27 visitors within the last 20 minutes
RSS News Feed