Solved

Another VB question

Posted on 2003-11-09
5
251 Views
Last Modified: 2010-04-17
OK..Well I have sort of making an RPG type game based off a game I made using Turing (its for computers class, dont ask).

What I want to happen is when your health equals a certain percentage a different image is shown in the picturebox, as if it were showing your health drop.
0
Comment
Question by:T_Smitty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9711543
if (health < 50) then
  me.Picture1.Picture = LoadPicture("C:\Weakened.jpg")
else if (health = 0) then
  me.Picture1.Picture = LoadPicture("C:\Dead.jpg")

mlmcc
0
 

Author Comment

by:T_Smitty
ID: 9711550
Oh and another thing..I have this on a n SSTab. How do I get it to update all the time? So the second the health drops it changes the pic.
0
 

Author Comment

by:T_Smitty
ID: 9711561
And also, will that be a percentage? or a number value? Like if the users health is 500 at max...will it show full health on the bar until they drop below 100?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 50 total points
ID: 9711621
>>How do I get it to update all the time?
Easiest way is to add a timer to the form.   Put code behind the timer to update the picture form.  Probably every half second.  Timing is in millseconds (1000 = 1 second)

>>And also, will that be a percentage? or a number value? Like if the users health is 500 at max...will it show full health on the bar until they drop below 100?
Number is what you want it to be.  If you are keeping health as an integer then use integers.  You could have it update the picture as often as you want.  Just need to have a different picture for each health level.  You also might want to use percentages for changing

If (Health > MaxHealth * 0.9) then
   FULL HEALTH PICTURE
Else if (Health > MaxHealth * 0.8) then
   ALMOST FULL HEALTH PICTURE
Else if
...
Else
   DEAD PICTURE
end if

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9711771
Glad I could help

mlmcc
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question