Game Development Reference
In-Depth Information
ThoughtsTextBox.AppendText(someThought & vbCrLf)
End Sub
The MainForm will hold our occupations for the simulated people to pick from.
Add the following line to the class:
Dim Occupations As New Collection
Now that we have a place to store them, we need to create our occupations.
We will be intentional about which one we load first. We want the Street
occupation to be the first one checked because it has a zero cost. Complete
MainForm_Load :
Private Sub MainForm_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Load the options - zero cost option must be first!
'Format is: Occupations.Add(New Job(Name, success as %, Cost, Gain, Loss))
'Busking/begging is free to do usually gets you almost two hours' pay
Occupations.Add(New Job("Street", 75.0, 0.0, 0.2, 0.0))
'Load the rest in any order.
'Very steady way to get a full day of pay.
Occupations.Add(New Job("Day Job", 99.0, 0.01, 1.0, 0.0))
'This pays better but bad days hurt.
Occupations.Add(New Job("Stuntshow", 70.0, 0.1, 2.5, 1.0))
'Cheap with high payoff.
Occupations.Add(New Job("Lotto", 0.01, 0.01, 10000.0, 0.0))
'Might pay big in the short run, costs in the long run.
Occupations.Add(New Job("Crime", 30.0, 0.02, 100.0, 200.0))
'You play and play and one day hit it big.
Occupations.Add(New Job("Rock band", 0.5, 0.05, 1000.0, 0.0))
'If you can afford the costs and risks, it pays best over time.
Occupations.Add(New Job("Financier", 66.0, 100.0, 220.0, 70.0))
'Reseed the rnd function.
Randomize()
End Sub
That loads all our occupations. It also makes sure that we get different random
numbers each time we run the application. Before we can go on, we need some
people.
 
Search Nedrilad ::




Custom Search