Game Development Reference
In-Depth Information
5. Double-click the Mage radio button. Visual Basic again takes us to the code,
and this time it creates a handler for the radio button's CheckedChanged
event. This event fires when the checked status changes, which includes
when the button goes from checked to unchecked. We only want to act if the
button was checked. Add the following code for the event handler:
If MageRadio.Checked Then
dieSize = 4
Call ComputeHitPoints()
End If
6. Add similar code for each of the other radio buttons. When finished, your
new code should look like the following:
Private Sub Level_ValueChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Level.ValueChanged
Call ComputeHitPoints()
End Sub
Private Sub MageRadio_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MageRadio.CheckedChanged
If MageRadio.Checked Then
dieSize = 4
Call ComputeHitPoints()
End If
End Sub
Private Sub ThiefRadio_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ThiefRadio.CheckedChanged
If ThiefRadio.Checked Then
dieSize = 6
Call ComputeHitPoints()
End If
End Sub
Private Sub ClericRadio_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ClericRadio.CheckedChanged
If ClericRadio.Checked Then
dieSize = 8
Call ComputeHitPoints()
End If
End Sub
 
Search Nedrilad ::




Custom Search