HUD: ZL Hearts

Started by froggy77, May 24, 2015, 06:35:56 PM

Previous topic - Next topic
May 24, 2015, 06:35:56 PM Last Edit: May 25, 2015, 07:41:25 PM by froggy77
----------------------------
HUD - "ZL HEARTS"
version 1.0


Attachment:  HUD - ZL Hearts.zip
----------------------------

- Explanation:
This stuff will help you to change the appearance of the health bar in your Solarus project.
The first heart represents the first four lives... OK stop! No further explanation!. A picture is worth a thousand words;

Example 1:
The original health bar (here, there are 15.5/20 hearts or 15.5 * 4 = 62 lives on 80) will be replaced by this smaller bar:


Example 2:
I played with the console to test "game:set_life()" and "game:set_max_life()"



- Tested with Solarus v1.4.2

- IMPORTANT !!! Save your files before replacing them!

- Copy these files in your Solarus project. The file path may differ from yours.

..\data\sprites\hud\empty_heart.dat    (There are 6 animations instead of 2 animations if you compare with the original data file.)

..\data\sprites\hud\hearts.png      (Some graphics are edited from a Zelda game. For copyright reasons, don't sell your project! )

..\data\scripts\hud\hearts.lua      (This file contains the main script edited from a original one by Christopho.)

..\data\scripts\hud\hud.lua      (It is not necessary to replace this file. The script contains a few more lines than the original created by Christopho. Keep yours and see below )
1st choice:
Copy the "hud.lua" file or add/replace these lines if you want to align element to right  when the player wins a new  heart container.
(...)
local hearts = hearts_builder:new(game)
hearts:set_dst_position(- (game:get_max_life() + 16), 6)
hud.elements[#hud.elements + 1] = hearts
local nb_max_hearts_displayed = game:get_max_life() / 4
(...)
local nb_max_hearts = game:get_max_life() / 4

if nb_max_hearts ~= nb_max_hearts_displayed then
nb_max_hearts_displayed = nb_max_hearts
hearts:set_dst_position(- (game:get_max_life() + 16), 6)
end
(...)


2nd choice:
Keep your "hud.lua" file if you want to align element to left when the player wins a new heart container.
Just adjust the x value of  hearts:set_dst_position(-104, 6)
Perhaps you should also change the value of x hearts.surface = sol.surface.create(116, 11) in the "hearts.lua" file.


EDIT:
- Erratum: For empty_heart.dat, I said there were "6 animations instead of 4 animations",  but it's "6 animations instead of 2 animations"
- Images were hosted at an ISP, so I attached them directly at the forum,  as I did with the .zip file.
You just have to be connected to see images.


I Imagine this will be very useful.
Can someone sticky this post?
This signature was way too long before, but now it's short!
Also, I am Still Alive!
On ad Off I go!

Do you ever get the feeling that the fandom of a product(s) ruin the potential that you could have had to enjoy the product?

I like having different life meter options.  I once started a project years ago that had a much different life meter function; Stamina played a key factor into the use of the life meter.

I'd like to implement this life meter style.

I am torn however between using one of two life meter options:

1. a 2-variant life meter, in which the red one was the normal mode and a blue one would be a hero mode version, kind of like the way the Ganondorf Amiibo makes Link take double damage on either mode of Twilight Princess.

2. a colored life meter that switches between 4 different colors; red for the highest or normal damage.  Yellow for 25% more damage.  Green for 50% more damage.  Blue would be 75% more damage, and every "in-game hour" you would lose a quarter of a heart unless you slept in a bed.

My tilesets page can be found here:
http://absolute-hyrule-tutorials.solarus-games.org/

Nice project! Both ideas are interesting. Sorry, I cannot choose for you. :P

I like the fact that this HUD is smaller, so that it hides less part of the map. (This style could be a nice option for the games of the Solarus team if Christopho likes the idea.) The idea I have in mind is to draw each life bar above others, like in fighting games with several life bars; each life bar could have a different color. I think 2 life bars could be ok (a red one and a different one above, maybe green, and both bars with 40 life points corresponding to 10 hearts). Also, the only heart on the left could beat when the life is low (we already have the beat animation), and replace that annoying sound of low life for a beat sound coordinated with the beat animation.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."


ffomega > Could you share the tileset version?
ffomega or Diarandor > Other request, could you draw a mock-up for these life meter styles?

Quote from: froggy77 on December 10, 2016, 06:33:44 PM

ffomega or Diarandor > Other request, could you draw a mock-up for these life meter styles?
@froggy77: I was refering to this heart system:
Quote

but with a possible addition of having one life bar above another, like in this screenshot where you can see the yellow life bar above the red one:
http://199.101.98.242/media/shots/36816-Dragonball_GT_-_Final_Bout_%5BU%5D-4.jpg
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Quote from: Diarandor on December 11, 2016, 11:19:07 AM
Quote from: froggy77 on December 10, 2016, 06:33:44 PM

ffomega or Diarandor > Other request, could you draw a mock-up for these life meter styles?
@froggy77: I was refering to this heart system:
Quote

but with a possible addition of having one life bar above another, like in this screenshot where you can see the yellow life bar above the red one:
http://199.101.98.242/media/shots/36816-Dragonball_GT_-_Final_Bout_%5BU%5D-4.jpg

Are you wanting a tileset version of my HUD? No problem at all :)  As for the mockup of my heart meter, that too won't be a problem :)

Here's a tileset version of the HUD I am trying to use:


Here's a mockup of the HUD with my heart meter (sadly there is no script for mine, as I am not a lua scripter):
My tilesets page can be found here:
http://absolute-hyrule-tutorials.solarus-games.org/

Quote from: ffomega on December 15, 2016, 04:10:32 PM
Are you wanting a tileset version of my HUD? No problem at all :)  As for the mockup of my heart meter, that too won't be a problem :)

Nope, but thank you :). I'd like to create my own hud by myself (which will have a similar style).
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Oh I apologize then :) I guess I do not understand what you were asking for ^^
My tilesets page can be found here:
http://absolute-hyrule-tutorials.solarus-games.org/

I was just saying that I like that hud style to display the hearts :D.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Quote
ffomega > Could you share the tileset version?
lol it was my question. Yes, it is what I
was asking for. Thanks. I'm going to test different versions of life meter styles. For the
moment, there is a problem with Dragonball style one, when the number of ♡ is odd.



if you manage to make an "Alundra" style life meter (which is where I was inspired to make mine from) then I'd love to use it!!
My tilesets page can be found here:
http://absolute-hyrule-tutorials.solarus-games.org/