Experience Bar Question
EricTippett
Member Posts: 45
Hey Everyone,
I am currently trying to create an experience bar. I looked at the health bar tutorial, but the experience isnt a set number every level.
They way I have experience set up right now is in an attribute called Player1Experience. Then I made an rule on the Player1Actor that as an Attribute game.Player1Experience is greater/equal to 100 * game.Player1Level^3
So the experience is saved after each level towards the next requirement.
I was trying to think of some way to have the old experience goal = 0 width and then have the new experience goal = the full width of the exp bar (currently 600)
So how would I make an experience bar for this, since both the starting number and level up number change every level?
I am currently trying to create an experience bar. I looked at the health bar tutorial, but the experience isnt a set number every level.
They way I have experience set up right now is in an attribute called Player1Experience. Then I made an rule on the Player1Actor that as an Attribute game.Player1Experience is greater/equal to 100 * game.Player1Level^3
So the experience is saved after each level towards the next requirement.
I was trying to think of some way to have the old experience goal = 0 width and then have the new experience goal = the full width of the exp bar (currently 600)
So how would I make an experience bar for this, since both the starting number and level up number change every level?
Best Answers
-
HC_DK Posts: 92I have made an example-file on how I would do it. Take a look at it and hopefully you will be able to make your own code work.
This is made as an iPhone project, therefore the "Full Exp Bar"-attribute is set to 400. You can change it to whatever you like and the "Player Level" and "Exp Bar" is calculated automatic.
Get the file here: http://dl.dropbox.com/u/12878764/Exp Bar.zip
HC -
HC_DK Posts: 92First, I would NOT combine those two :-) But that is your call....
Try to solve the HP bar yourselves and if you run into trouble, let me know. I wanna help BUT helping is not the same as making the code :-) And you will learn a lot more by doing it yourselves.
You can use a lot of the "code" in the Exp Bar-example or else have a look at:
HC
Answers
Constrain Attribute: self.size.Width = game.Player1Experience - (100*(game.Player1Level-1)^3)
However, I need it to fill up to 600 pixels wide and 600 would be the bar at 100% experience. So how could I tell it to fill up according to that?
So for mine the width of the bar is 0 - 600 pixels.
The start point of the bar at 0 px would be the last levels exp goal so 100 * (game.Player1Level - 1) ^3.
The end point of the bar at 600 pixels would be 100 * (game.Player1Level)^3.
Do you know how I would create that since the start and end is always changing and isnt a set number?
Do you think this would work for when I get to HP bars that will also have a max value that will change every level gained?
But just wondering since you mentioned it.. how would you combine a HP bar into a XP bar lol? Wouldnt that be a weird mechanic, so instead of losing life when hit you lose XP?
Thanks for helping me out by the way!
But yeah I was able to create a HP and Energy bar with your method, so thanks!
Im curious, could you be more specific regarding the attributes you're using in your game, I wanted to implement the same method, I'm not looking for an experience bar at the moment, just the logic behind tracking experience and leveling up.
Do you realize this thread is 2 years old?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
..ok
you don't have to be mean.....