How do I set up health pick up?

  • Hi guys .. I wanna make a health potion that once you grab it, it'll heal you to full health.

    Problem is how can I tell game to only heal my lost health not adding it.

    i.e :

    500/500 - 200 = 300/500 -> Grabs Health Pickup -> Full Health 500/500 <-- this is what I wanna tell my game

    Not

    500/500 - 200 = 300/500 -> Grabs Health Pickup -> 800/500 <-- not what I wanted

    Note : I dont use global variable for this.

    Btw I'm a visual learner.. hopefully you guys can post example .capx cause I don't understand text as much.

    I wish I could post my .capx but my rep is <300

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can make another instance variable with the name "maxhealth" and set it value to 500, when you want to restore hp, just set your "health" value to "maxhealth".

    Or use math: set health to min(health+x,500). Change x to whatever value you want, Health will never be greater than 500.

    Example: https://dl.dropboxusercontent.com/u/101 ... oreHP.capx

  • You can make another instance variable with the name "maxhealth" and set it value to 500, when you want to restore hp, just set your "health" value to "maxhealth".

    Or use math: set health to min(health+x,500). Change x to whatever value you want, Health will never be greater than 500.

    Example:

    OMG OMG OMG your math solution worked!!!! <3 <3

    I love you soo much <3

    thank you..thank you..

    you have my eternal gratitude <3

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)