Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtract xp from previous level #6

Open
Mias15 opened this issue Apr 24, 2023 · 5 comments
Open

Subtract xp from previous level #6

Mias15 opened this issue Apr 24, 2023 · 5 comments

Comments

@Mias15
Copy link

Mias15 commented Apr 24, 2023

Would it be possible to add the option to subtract the xp from the previous level? It would make it possible to indicate the total xp at the top but only the progress of the current level would be shown at the xp bar.

@krishsharma0413
Copy link
Owner

Please explain in again with an example. I wasn't able to understand

@Mias15
Copy link
Author

Mias15 commented Apr 25, 2023

Sure, no problem. With the current code it is only possible to show the total XP in the bar, but I would like to have a way to subtract the xp from the previous level so that you only see the advance from the current level in the XP bar.

The following code makes this possible:
bar_exp = round(((self.current_exp - self.previous_exp) / (self.max_exp - self.previous_exp)) * 619)

Here you can see the differenz between the two calculation methods:
image

@krishsharma0413
Copy link
Owner

So you want to make it so that the bar shows the progress of the current level and not just the entire XP he earned before?

@Mias15
Copy link
Author

Mias15 commented Apr 25, 2023

correct; the finished code is already available in the open pull request

@krishsharma0413
Copy link
Owner

alright, I will review and merge accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants