I can't figure out how to make my Progress Bar into a Health Bar V

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 1178 Views - Last Post: 25 September 2012 - 11:50 AM Rate Topic: -----

#16 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: I can't figure out how to make my Progress Bar into a Health Bar V

Posted 25 September 2012 - 11:50 AM

View PostTheVoliand, on 25 September 2012 - 09:37 AM, said:

 if picturebox2.intersectswith.picturebox3 then
          progressbar2.value = -10

In vb.net you would need to keep the current value. You can do this one of two ways.
ProgressBar2.Value = ProgressBar2.Value - 10
or a shortcut method
ProgressBar2.Value -= 10

Both of these are basically saying:
The value of progressbar2 is equal to the current value of progressbar2 minus 10

So if ProgressBar2.Value = 80
ProgressBar2.Value -= 10
would result in ProgressBar2 having a value of 70
be sure to always check for going below a value of 0 or your program will crash.

This post has been edited by CharlieMay: 25 September 2012 - 11:52 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2