Advertisement
ssoni

ClashofClickers

Feb 8th, 2022
1,533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.23 KB | None | 0 0
  1. Public Class Form1
  2.     Public health As Integer
  3.  
  4.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  5.         health = 100
  6.         picHealthBar.Width = health
  7.         lblHealth.Text = health
  8.     End Sub
  9.  
  10.     Private Sub picGood_Click(sender As Object, e As EventArgs) Handles picGood.Click
  11.         health = health + 5
  12.         picHealthBar.Width = health
  13.         lblHealth.Text = health
  14.     End Sub
  15.  
  16.     Private Sub picBad_Click(sender As Object, e As EventArgs) Handles picBad.Click
  17.         health = health - 5
  18.         picHealthBar.Width = health
  19.         lblHealth.Text = health
  20.     End Sub
  21.  
  22.     Private Sub picHealthBar_Click(sender As Object, e As EventArgs) Handles picHealthBar.Click
  23.  
  24.     End Sub
  25.  
  26.     Private Sub picMedium_Click(sender As Object, e As EventArgs) Handles picMedium.Click
  27.         Dim r As New Random
  28.         Dim prize As Integer
  29.  
  30.         'generate random health damage
  31.         prize = r.Next(-5, 5)
  32.  
  33.         If prize = 0 Then
  34.             prize = r.Next(-5, 5)
  35.         End If
  36.  
  37.         'update health
  38.         health = health + prize
  39.  
  40.         'update screen with new health value
  41.         picHealthBar.Width = health
  42.         lblHealth.Text = health
  43.  
  44.     End Sub
  45. End Class
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement