Jump to content
MakeWebGames

Recommended Posts

Posted

I am new to all this and i trying to make this.

$hpperc = min((int) ($ir['hp'] / $ir['maxhp'] * 100), 100);
$hpopp = 100 - $hpperc;

<b>Health:</b> {$hpperc}%<br />
<img src='greenbar.png' width='$hpperc' height='10' /><img src='redbar.png' width='$hpopp' height='10' />

To work with this.

           <div class="stats">
           	Health100%
               <div style="padding-left: 19px;">
           	<div style="background: url(images/bg-bar.png) no-repeat;width:62px;height:26px;">
               <div style="background: url(images/red-bar.png) no-repeat;width:62px;height:26px;">
               <div style="color: #e4dfca;position: absolute;padding-top: 6px;padding-left:18px;">100%</div>
               </div></div></div>
           </div>

If anyone can help that would be much appreciated.

Posted

Because his total width is 62px using the current $hpperc will do from 1-100px.

You'll need to change your $hpperc line to something to the effect of.

$hpperc = min((int) ($ir['hp'] / $ir['maxhp'] * 62), 62);
Posted

I have used SomeRandomBastards way and it seems to work fine, but it kills the images. and i had a snip at the code and it dies on

float: left;"></div>

but with out the bars dont move with the % of health you have

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.   Paste as plain text instead

  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...