Game Development Reference
In-Depth Information
Public Function Cost() As Double
Return myCost
End Function
Public Function Gain() As Double
Return myGain
End Function
Public Function Loss() As Double
Return myLoss
End Function
There is only one thing left to do with the Job class. To make things easier, we
want to be able to ask it to use a random number to compute a day's wages or
losses. To do this, we will provide the following function:
'Return either the gain or loss
'based on the probability.
Public Function Wages() As Double
If Rnd()< myPSuccess Then
Return myGain
Return -myLoss
End If
End Function
That completes the Job class. Click Save All on the File menu, and we can proceed
to the user interface. Go to the Design view of MainForm.vb:
1. Change the Text property to Day In The Life.
2. Resize the form to make it larger. A size of 930 by 450 should suffice.
3. Drag a button to the top-left corner of the form. Change the Name property
to EddyButton and the Text property to Eddy.
4. Drag a text box to the form. Change the Name property to Thoughts-
5. Set the Multiline property to True.
6. Resize and position the text box to take up all of the form to the right of the
Eddy button.
Search Nedrilad ::

Custom Search