Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / health bars

Author
Message
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 29th Nov 2003 05:37
I'm making a FP shooter and i'm having trouble positioning the heathbars where i want them and also having trouble scaling them correctly so it's display is accurate. Any help, comments, or code would be appreciated.

Sparring - Loved by many, Pefected by few.

I'm going to live forever, or DIE IN THE ATTEMPT!!!"
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 29th Nov 2003 05:42
Hmm, what do you mean?

Are yuo trying to position Sprites?

Or are they Primitives?

Could you please post some code so we can help... Thanks


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 29th Nov 2003 21:05
http://darkbasic.thegamecreators.com/?m=codebase_view&i=323ec8aaefddfc208a067980eb0f621d

Just fiddle around with this code.

Change this line of code to reposistion the box.
(H is your variable, so don't mess with that one.)

box 10,20,H,30 - Top left

If you want the health bar to be longer, do this...

box 10,20,H-10,30
box 10,20,H+10,30

What display are you running in?(800 by 600, 1024 by 768 etc.)
Just fill in different values, and you'll eventually get it where you need.



A book? I hate book. Book is stupid.
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 29th Nov 2003 22:49
thanks yellow, i didn't know you could place 2d objects over 3d ones in darkbasic clasic, would it hurt my fps any if i used a sprite without transparency?

@JessTicular
I was thinking about using 3d primitives but if i can get it to work with sprites that would make it a whole lot easer, i was trying to fegure out how to position a plain in a certen portion of the screen, i could get it to display right in front of the camera and move it back and forth but i couldn't display it in like just the uper right hand corner where i wanted it. (a helthbar in the middle of my screen is not quite what i had in mind for my game )

Sparring - Loved by many, Pefected by few.

I'm going to live forever, or DIE IN THE ATTEMPT!!!"
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 29th Nov 2003 23:07
Not to sure, never used dbc. Guess you'll just have to try both, and compare fps.

syntax:
print screen fps()



A book? I hate book. Book is stupid.
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 30th Nov 2003 01:51
yeah, i can't seem to get it working in my game though, i wrote a function to use but i can't seem to get it to work, i think the function would work in pro(don't know though) but i can't seem to get the boxes to display in the little test program i made. here's the code:


Sparring - Loved by many, Pefected by few.

I'm going to live forever, or DIE IN THE ATTEMPT!!!"
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 30th Nov 2003 06:28
I just wrote this for you:



That'll work for anything you pass it (hopefully)

The xpos and ypos values specify the top left corner of the health bar

The name$ is what get's printed on the health bar.


That should help you on the right path.

Btw, Sprites will slow your game down drastically if you use any number of them... They are evil little buggers in DBC.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 1st Dec 2003 04:55
thanks JT , I've finaly got the health bars working thanks to your help, checkout the screenshots of my game sofar, I'll have to post some more with the healthbars, thanks a bunch.
CPU

Sparring - Loved by many, Pefected by few.

I'm going to live forever, or DIE IN THE ATTEMPT!!!"
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 1st Dec 2003 07:52
Yeah, that's cool, Glad to help

Btw, where can i view screenshots?


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 2nd Dec 2003 23:49
I've posted my game in the W.I.P. folder, it has a link to my website.
Good luck!
CPU

Sparring - Loved by many, Pefected by few.

I'm going to live forever, or DIE IN THE ATTEMPT!!!"

Login to post a reply

Server time is: 2025-05-22 07:00:27
Your offset time is: 2025-05-22 07:00:27