Solved

Another VB question

Posted on 2003-11-09
5
252 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 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 101

Expert Comment

by:mlmcc
ID: 9711771
Glad I could help

mlmcc
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

623 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