Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Life Bar System

Talk about anything related to Platinum Arts Sandbox here!
User avatar
GoBologna120
Member
Member
Posts: 167
Joined: June 10th, 2009, 3:07 pm
Name: Tim
IRC Username: GoBologna
Location: Nowhere in particular.

Life Bar System

Post by GoBologna120 »

I would like to know if it's possible to give your character a life bar that floats above their head using only a .cfg. I'm not very good at C++, so I'm not sure that I can really code it into the source code.
Image
Yay. ^_^
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Life Bar System

Post by Hirato »

it's literally one line of code, the declaration you'd want to use...

Code: Select all

extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
and how you'd use it

Code: Select all

particle_meter( player1->abovehead(), 100 * player1->health / player1->maxhealth, PART_TEXT, 1, 0xFF0000, 0, 2.0f);
might require a few attempts, but good luck (and check the wiki on compiling)
This is not a url, clicking it is pointless
User avatar
Mike
Administrator
Administrator
Posts: 871
Joined: May 24th, 2009, 12:52 pm

Re: Life Bar System

Post by Mike »

And/or you could check out the RPG :D Take care.
-mike
Sign up for our Newsletter to keep up to date with the Sandbox news!
We also have a facebook page, facebook group, myspace page and a twitter page[/b][/color]!
User avatar
GoBologna120
Member
Member
Posts: 167
Joined: June 10th, 2009, 3:07 pm
Name: Tim
IRC Username: GoBologna
Location: Nowhere in particular.

Re: Life Bar System

Post by GoBologna120 »

Hirato wrote:it's literally one line of code, the declaration you'd want to use...

Code: Select all

extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
and how you'd use it

Code: Select all

particle_meter( player1->abovehead(), 100 * player1->health / player1->maxhealth, PART_TEXT, 1, 0xFF0000, 0, 2.0f);
might require a few attempts, but good luck (and check the wiki on compiling)
Awesome! Thanks. I'll check the RPG source to see where I'd put it.
Image
Yay. ^_^
User avatar
DarthMaak
Member
Member
Posts: 10
Joined: June 16th, 2009, 2:22 pm

Re: Life Bar System

Post by DarthMaak »

Hirato wrote:it's literally one line of code, the declaration you'd want to use...

Code: Select all

extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
and how you'd use it

Code: Select all

particle_meter( player1->abovehead(), 100 * player1->health / player1->maxhealth, PART_TEXT, 1, 0xFF0000, 0, 2.0f);
might require a few attempts, but good luck (and check the wiki on compiling)
Does this require me to make a new cfg document or is there some kind of already-made-cfg document I can import this in?
"Vader: Obi-Wan once thought as you do. You don't know the power of the Dark Side!"
-Palpatine: Are you threating me master Jedi?
-Mace: The Senate will decide your fate.
-Palpatine: I *AM* the Senate!
-Mace: Not yet.
-Palpatine: It's treason, then. :twisted:
User avatar
GoBologna120
Member
Member
Posts: 167
Joined: June 10th, 2009, 3:07 pm
Name: Tim
IRC Username: GoBologna
Location: Nowhere in particular.

Re: Life Bar System

Post by GoBologna120 »

This goes in the source code. You don't use a .cfg.
Image
Yay. ^_^
CollegeforKids
Restricted User
Posts: 27
Joined: June 16th, 2009, 10:50 am
Name: Caitlin

Re: Life Bar System

Post by CollegeforKids »

GoBologna120 wrote:This goes in the source code. You don't use a .cfg.
I'm a little confused by this statement. Does it go in an OGZ file then?
User avatar
GoBologna120
Member
Member
Posts: 167
Joined: June 10th, 2009, 3:07 pm
Name: Tim
IRC Username: GoBologna
Location: Nowhere in particular.

Re: Life Bar System

Post by GoBologna120 »

Looked at the Wiki recently?
http://sandboxgamemaker.com/wiki/index. ... ource_code
It's C++ code, therefore, you have to recompile the game to use it.
Image
Yay. ^_^
CollegeforKids
Restricted User
Posts: 27
Joined: June 16th, 2009, 10:50 am
Name: Caitlin

Re: Life Bar System

Post by CollegeforKids »

I get it now, you must understand my confusion. Considering the only thing that explains how to edit code (for an actual purpose that is mentioned...aka NPCs) says to edit it in the config. The wiki doesn't really explain when you need to use C++ and compile...yet ;)
User avatar
GoBologna120
Member
Member
Posts: 167
Joined: June 10th, 2009, 3:07 pm
Name: Tim
IRC Username: GoBologna
Location: Nowhere in particular.

Re: Life Bar System

Post by GoBologna120 »

That's because you can do so much without recompiling. :)

EDIT: Okay. I can't figure out where to put it. :(
Image
Yay. ^_^
Locked