Adding half-hearts to a Zelda hearts system?

  • Capx

    (if you look at the heart object, it does already have an animation for half-hearts)

    I'm working on a Zelda-style health system (hearts) and I have it nearly working, such as setting max rows, dropping to y height (for a new row), properly removing and adding hearts, etc but one problem: I'm trying to wrap my head around on how to add half hearts, but I'm having difficulty finding a system that works or that doesn't have bugs in it. I've tried pick from top/bottom but I can't figure out how to tell C2 to move onto the next leftmost heart without it just not doing anything after depleting the rightmost heart to empty. I've tried instance variables to set individual heart health too, but I feel dumb since I got stuck there too. I mean, I know how to use instance variables to make the transitions work ,but no luck moving to the next rightmost heart after one is "empty".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I haven't had time to look into your capx in very great detail, but here's an idea: what about counting the number of 'hits' the player can take, instead of the number of 'hearts'? ie 6 health displays as 3 hearts, 5 health displays as 2.5 hearts. You could perhaps use the modulo operator (%) to figure out if the current health stat is odd or even, and if odd, set the rightmost heart to display the 'half' animation. Or you could test to see if health /2 is a perfect integer and if it isn't, do the half heart.

    Don't know if that will help you in any way, just farting ideas out

  • Edited:

    here is my solution Capx Example v2 updated

    let me know if you need something else...

    @Ashley i found a bug when i try duplicate a button then renaming it and changing the text info ... C2 editor crashes (use original capx in the first post)

    steps to reproduce :

    duplicate button named Add Heart

    change name of the new duplicated button

    change text of the new duplicated info

    on pressing enter after text is changed or clicking the layout so the text its saved C2 Crashes. r228 x64 Win8

    Edited : in my capx now it doesn't do it anymore after it crashed around 3 times... first time it crashed was due to the name length i think... i'll retest and submit to the bug section properly once i pin down the cause. sorry for rushing on reporting and in such a inappropriate topic.

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