Solved

Another VB question

Posted on 2003-11-09
5
247 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This is about my first experience with programming Arduino.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now