Adding half-hearts to a Zelda hearts system?

Get help using Construct 2

Post » Thu May 19, 2016 4:43 am

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".
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Thu May 19, 2016 7:25 am

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. suggestion-is-even-or-odd-for-expressions_t57125 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 ;)
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 205
Reputation: 3,468

Post » Thu May 19, 2016 7:51 am

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.
B
77
S
23
G
69
Posts: 1,353
Reputation: 43,960


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, dop2000 and 37 guests