[SOLVED]Problem with health mechanic.

0 favourites
  • 8 posts
From the Asset Store
Custom Health Bar
$3.50 USD
30% off
Custom animated Health Bar - check youtube video to make it yourself
  • Hey guys!

    Hope you all are doin' better than me.

    I have this nasty problem with a math (?) formula (don't know if I spell that right), or at least I think it's because of that since I suck at logic and maths :3


    The thing that happens, is that everytime the player gets a shoot the ActualHealth goes from 100 to 0, instead of taking the 10 from the impact ( the variable Difficulty is at 1, and PlayerShip.Plating is at 0 ). Then if you take a second shoot, it doesn't go negative but increases to +10; and it stays as 10 then, no matter how many shoots it recieves.

    Any ideas guys? I'm really troubled by this, since the formula I want to use when the shield gets activated, its based on this one too. º^º

    Ps: Please excuse my english and grammar.


  • Frame Matt

    Can you give us capx or wider picture of the whole sheet?

  • DamageTaken should be called before PlayerHitted()?

    Also make sure your variables are numbers and not strings.

  • I would preffer to not submit a capx, but hopefully this images do the job.

    Here's the whole pic of the sheet on where I think it's the problem

    The other 3 player groups have no event related to this matter.


    Here the function GUIUpdate, which is called by PlayerHitted.


    Both event sheets are loaded on the main sheet.


    And here are the variables.


    DamageTaken should be called before PlayerHitted()?

    Also make sure your variables are numbers and not strings.

    When did that, the first hit, instead of drop the health all the way to 0, it drops to 10. :/

    *I don't know if we're going to solve this, but still, thank you for your help guys (:

  • You should try the very basic. "Hp - damage". Then display it. and add to it one step at a time.

  • I actually did that! but couldn't find anything.

    But a user on a Construct 2 LatAm facebook group, told me to change the "substract to" on the function PlayerHitted, for a "set to". And it seems to be working, I've been moving some parameters to check how the formula does, and it looks fine. When you think about it, it makes sense to have it setted for "set value to".

    So, I guess, that's the way to go when you are doing maths that change the overall value.

    Still, thank you guys <3

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Frame Matt , you should reference people in future, so they get your alerts so they can answer you

    Glad you found a solution.

  • Oh, that's the tagging for?

    I, actually, was subscribed to this topic via e-mail. I'm certainly going to try it next.

    Thank you razorMonkey (:

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