playMaker

Author Topic: [SOLVED] Another health bar thread  (Read 12753 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: working health bar _ example _ unity package _ download
« Reply #15 on: October 10, 2012, 08:36:01 AM »
gui health bar boxes 101


I'm not sure if it is what you have been looking for @krakov73 but explaining this solution looked like taking more time that actually sharing it done.

A.

That looks lovely! I like the AI ;)
Best,
Sven

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: Another health bar thread
« Reply #16 on: October 10, 2012, 08:53:53 AM »
Yeah this ai is little rough. I try to master use of boxes everywhere first :)
Glad it helped.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14342
  • Official Playmaker Support
    • View Profile
Re: Another health bar thread
« Reply #17 on: October 11, 2012, 12:35:13 AM »
Hi,

 Impressive Andrew, very impressive. It clearly shows that you can do so much with playmaker!
I have added it to the wiki:

https://hutonggames.fogbugz.com/default.asp?W548

I think I will soon make a special page for such samples, cause more and more quality samples are shared.

I have however made a convenient custom action to do this billboard math in one go, which will be easier to replicate whenever:

http://hutonggames.com/playmakerforum/index.php?topic=2417.0


Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14342
  • Official Playmaker Support
    • View Profile
Re: Another health bar thread
« Reply #18 on: October 11, 2012, 03:21:11 AM »
Hi,

 Now the easiest way to go around this is the following:

I created an action to change the width and height of a gui texture:
http://hutonggames.com/playmakerforum/index.php?topic=2420.0

then I used the worldScreenToScreenPoint action:
https://hutonggames.fogbugz.com/default.asp?W571

that I set to "Normalize" which essentially is then becoming WorldScreenToViewPoint

then it's very easy to do a health bar following an object on screen.

I have attached a working example. Simply move the cube around using the editor, and edit the fsm "change gui texture size" value ( found in the inspector).

bye,

 Jean

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • my twitter @andrewlukasik
Re: Another health bar thread
« Reply #19 on: October 11, 2012, 03:53:37 AM »
Thanks Jean! Now I know how to do it with GUI at last :)
I wonder which method is better or faster.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14342
  • Official Playmaker Support
    • View Profile
Re: Another health bar thread
« Reply #20 on: October 11, 2012, 04:10:05 AM »
Hi,

 The fastest method will not be in terms of scripting but in terms of drawcall if you are on mobile, on desktop and web, I doubt you will every see a difference. That will be especially true if you start to have 20 30 healthbar or similar stuff on screen, then you WILL need to use systems like 2d toolkit or SM2 to combine all the 2d gui into one draw call.

 Actually that could be a good benchmark, taking Andrew system , using a lot more of playmaker, and custom actions.testing with a simply scene that keeps adding cubes with health bars and check perfs.

bye,

 Jean
 

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
    • View Profile
Re: Another health bar thread
« Reply #21 on: October 11, 2012, 06:17:42 AM »
I now have 3 examples that solve or effectively solve what I wanted to do, the support on here blows me away.

Thanks again all.