playMaker

Author Topic: Custom health bar?[SOLVED]  (Read 2310 times)

Ukiyos

  • Playmaker Newbie
  • *
  • Posts: 6
Custom health bar?[SOLVED]
« on: February 22, 2019, 09:52:54 PM »
I've designed a custom health bar for my game, which wont be able to just scale down the bar itself, I'd like to transition between a set of images (see images attached) but I'm not sure quite how to go about this, so any advice is greatly appreciated!

Side note: the current "fix" for this is rather bulky, cross multiplying the current health total health to the number of images, rounding to the nearest integer, and displaying the corresponding image, ideally I'd like to make it more gradual than going in steps.
« Last Edit: February 27, 2019, 01:52:50 AM by jeanfabre »

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Custom health bar?
« Reply #1 on: February 22, 2019, 10:42:07 PM »
Have you try using UGui ?
Try to choose Image instead of using sprite renderer and change the fill mode to radial 360

You can use “ease” to animate the variables.

Hope it will helps
« Last Edit: February 22, 2019, 10:44:01 PM by ch1ky3n »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Custom health bar?
« Reply #2 on: February 22, 2019, 11:27:18 PM »
Hi.
You can use the standard ui actions.

Make some ui images to build your heath indicator.

Then, the on ui image which will indicate the percentage :

Set image type to "Filled"
and play around with the setting you wish to use to fill.

Then you can use the action "Ui Image Set Fill Amount"
to manipulate it @ run time.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Custom health bar?
« Reply #3 on: February 24, 2019, 08:05:13 AM »
You could use the swap sprite action (on Ecosystem) or similar. Basically, from start state, check if health is lower than X, go to next state, if higher than X, go to previous state. Underneath the check, you put each a swap sprite action with the corresponding image.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom health bar?
« Reply #4 on: February 26, 2019, 03:10:59 AM »
Hi,

As Djaydino said above ( sorry I posted and realized you gave the solution already :) ), you need to use Image's Image Type filled with Fill method set to Radial 360 and done...



- Use the action UiImageSetFillAmount to control the fill amount

- Then it's matter of doing proper composition to achieve your final look.

Bye,

 Jean
« Last Edit: February 26, 2019, 03:22:42 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Custom health bar?
« Reply #5 on: February 26, 2019, 03:46:25 AM »
Hi.
No problem, you answer is more detailed with the gif image included :)

hoyoyo80

  • Full Member
  • ***
  • Posts: 136
Re: Custom health bar?[SOLVED]
« Reply #6 on: February 28, 2019, 03:04:10 AM »
@jean, can i have the source please:) Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom health bar?[SOLVED]
« Reply #7 on: March 01, 2019, 06:23:29 AM »
Hi,

Sure, here it is, I made it nicer with an Fsm so that you can see how to control it via Fsm, just change the value in the Fsm inspector, and the gauge will refresh itself.



open the scene Circular Gauge.

Bye,

 Jean