Thread: Health for HUD
View Single Post
  #2  
Old 09-18-2010, 10:16 PM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
lol.. well that's one way to do it..

To simply answer your first question, you have to hide the images as well.

hideimg(index); to hide a single showimg.
or
hideimgs(min index, max index); to do a range.

Other than that, your scripting is extremely distasteful, but I suppose it'll work and I don't care to tell you much more than that.

Also, use setTimer(.05); instead of timeout=.05;

Here's a hint for making it better:
PHP Code:
function onPlayerEnters() {
  
onTimeOut();
}
function 
onTimeOut() {
  
setTimer(.05);
  
hideimgs(300this.images);  //Clear the old images
  
this.images 300;  //Start a new image counter
  
temp.maxHearts 5//Max heart count
  
for (temp.i=0;temp.i<temp.maxHearts;temp.i++) { //Loop through the possible heart values
    
if (temp.i>player.hearts) break; //Dont exceed the players heart count
    
this.images++; //"Allocate" a new image
    
showimg(this.images"block.png"32+temp.i*4832); //Draw the heart at the proper position.
    
findimg(this.images).layer 5//Screen-relative layer
  
}

Ya. If something doesn't work or whatever, I did type this on my phone.. But I hope you appreciate that little snippet.
}

Last edited by 12171217; 09-18-2010 at 10:26 PM..
Reply With Quote