A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Health bar lowers on click

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    4

    Max Number Variable

    EDIT: I already solved the healthbar problem. Now what I want to know is if there's a way to set a max number for my health. For example, when I click "heal", it goes way over the max HP which is 100. Is there a way to set the max number to 100? Thanks!
    Last edited by vivyo; 11-24-2010 at 11:44 PM.

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    should heal just be health = 100?

    like

    heal_btn.onPress = function(){
    health = 100;
    }

    or does each 'health' have different amounts/number it adds?

    if yes.. then maybe:

    heal_btn.onPress = function(){
    health += (whatever amount you want here);
    if( health > 100){
    health = 100;
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center