Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Another VB question

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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

This is about my first experience with programming Arduino.
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.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

705 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