EOSERV Forum > Game Development > Trouble with my exp bar?
Page: << 1 >>
Trouble with my exp bar?
Author Message
Post #199250 Trouble with my exp bar?

i trying to draw out my tnl bar and cant figure it out after the first level up it does not zero out.

int nextlevel = world->exp_table[world->character->level+1];//same leve up struct as eo

int d = static_cast<double>(world->character->exp) / static_cast<double>(nextlevel) * exp_bar->width; //156 width

rect.x = 0;
rect.y = 36;

rect.w = d;
rect.h = 17;
world->video->Draw(320 - world->video->hpmp_bar->w / 4,36,world->video->hpmp_bar,&rect);

I use the same furmula to draw my hp and mp bars and it seems to work fine .what im looking for is the correct formula to display tnl any help would be appreciated thanks!

Level 0 the empty bar is the tnl meter.



Level 3 fresh level upand the tnl meter is half full.

8 years, 15 weeks ago
Post #199251 Re: Trouble with my exp bar?
int nextlevel = world->exp_table[world->character->level+1];
int curlevel = world->exp_table[world->character->level];
double expdiff = nextlevel - curlevel;
double tonextlevel = world->character->exp - curlevel;
int d = tonextlevel / expdiff * exp_bar->width;
8 years, 15 weeks ago
Post #199256 Re: Trouble with my exp bar?

Thank you! I'll archive that furmula in my brain for some reason those 2 middle vars were slipping my mind I appreciate ya!!

8 years, 15 weeks ago
Post #199260 Re: Trouble with my exp bar?

btw what's your game engine allegro 5 or what?

---
Remember when is not an organization nor a fucking group , it's simply an idea that we believe in
and live for.
The priority of Remember when should come before oxygen , as oxygen is cosmetic even life itself is
cosmetic,that's why offer our worthless lives to The "Remember when"
8 years, 15 weeks ago
Post #199277 Re: Trouble with my exp bar?

right now I am using sdl for the gfx and irrklang for the audio!

8 years, 15 weeks ago
Page: << 1 >>

EOSERV Forum > Game Development > Trouble with my exp bar?