geatzo Posted February 11 Share Posted February 11 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% Quote Link to comment https://forums.phpfreaks.com/topic/317923-finding-out-the-of-2-variables/ Share on other sites More sharing options...
Solution Barand Posted February 11 Solution Share Posted February 11 current ------- X 100 = percent full Quote Link to comment https://forums.phpfreaks.com/topic/317923-finding-out-the-of-2-variables/#findComment-1615260 Share on other sites More sharing options...
geatzo Posted February 11 Author Share Posted February 11 (edited) 4 minutes ago, Barand said: current ------- X 100 = percent full Thank you i understand now Edited February 11 by geatzo Quote Link to comment https://forums.phpfreaks.com/topic/317923-finding-out-the-of-2-variables/#findComment-1615261 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.