Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Public health As Integer
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- health = 100
- picHealthBar.Width = health
- lblHealth.Text = health
- End Sub
- Private Sub picGood_Click(sender As Object, e As EventArgs) Handles picGood.Click
- health = health + 5
- picHealthBar.Width = health
- lblHealth.Text = health
- End Sub
- Private Sub picBad_Click(sender As Object, e As EventArgs) Handles picBad.Click
- health = health - 5
- picHealthBar.Width = health
- lblHealth.Text = health
- End Sub
- Private Sub picHealthBar_Click(sender As Object, e As EventArgs) Handles picHealthBar.Click
- End Sub
- Private Sub picMedium_Click(sender As Object, e As EventArgs) Handles picMedium.Click
- Dim r As New Random
- Dim prize As Integer
- 'generate random health damage
- prize = r.Next(-5, 5)
- If prize = 0 Then
- prize = r.Next(-5, 5)
- End If
- 'update health
- health = health + prize
- 'update screen with new health value
- picHealthBar.Width = health
- lblHealth.Text = health
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement