Rdogg112 Posted August 6, 2009 Share Posted August 6, 2009 umm, im making a game and characters HP so far is just text how would i make an image of about 1px X 5px show if the hp is 50 it would show 50 times like this: HP 50/100 could anyone help me? Quote Link to comment Share on other sites More sharing options...
watsmyname Posted August 6, 2009 Share Posted August 6, 2009 umm, im making a game and characters HP so far is just text how would i make an image of about 1px X 5px show if the hp is 50 it would show 50 times like this: HP 50/100 could anyone help me? <?php $hp=$_GET["hp"]; ?> <img src='line.jpg' width='<?php echo $hp; ?>' height='5px' /> Quote Link to comment Share on other sites More sharing options...
alexdemers Posted August 6, 2009 Share Posted August 6, 2009 If it's 1 pixel large, stretching it is the best option. If, let's say you have hearts (like in Zelda), then you would need to repeat it using a simple for loop: <?php $lives = 4; for ( $i = 0; $i < $lives; $i++ ) { echo '<img src="/images/heart.png" alt="<3" /> '; } ?> Quote Link to comment 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.