Jump to content

finding out the % of 2 variables


Go to solution Solved by Barand,

Recommended Posts

I am working on a pokemon battle script ive pretty much done it all but ive got stuck on a  hp bar.

https://prnt.sc/6b4PeawglS2t

 

Has you can see from the screenshot i have a hp bar to show users how much health is left.  I work out what the hp should be by timing there level by 6 so i have a variable called $fullhp which is what the full hp should be then im storing the current hp in a database  and grabbing it with $ current

so $fullhp  could be 60

$current = 10

i am stuck on how to work out the maths the bar uses a %

 <div id="pokemon_life" role="progressbar" style="width: 45%;" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" class="hp_progress"></div>

 

I have to edit the bar with the width: 45%

 

 

Link to comment
https://forums.phpfreaks.com/topic/317923-finding-out-the-of-2-variables/
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.