Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Another VB question

Posted on 2003-11-09
5
Medium Priority
?
255 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 101

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 101

Accepted Solution

by:
mlmcc earned 200 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 101

Expert Comment

by:mlmcc
ID: 9711771
Glad I could help

mlmcc
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Simple Linear Regression
Screencast - Getting to Know the Pipeline

783 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