I'm trying to create a bar in a screen to display a character's stats. That's all well and good, except the bar isn't a single solid block, but rather, 5 dots. I've included the background UI to show where the dots go.
I can make the bar show the image like normal, but I didn't like how it was displaying the progress, because it isn't actually 1:1 in terms of where the progress is. That is, having a stat whose value is 20 out of 100 should fill up the first dot, but it doesn't, because it's not proportional to progress.
So, what I WANT to do is find a way to set the value of the bar to increments of the character's stats. That is, if the character's stat is at 20, I set the value to make the bar display 10 pixels. If the stat is at 40, display 25 pixels.
The stat value goes up to 100, and the max length of the bar UI image is 70 pixels.
Each increment is as follows:
- 20 points - 10 px
- 40 points - 25 px
- 60 points - 40 px
- 80 points - 55 px
- 100 points - 70 px
I know how to do a simple "if then" statement, like, theoretically, this would change the value of the bar's length variable based on the stat variable:
Code: Select all
if $ v_mind >= 100:
$ bar_mind = 100
elif $ v_mind >= 80:
$ bar_mind = 80
elif $ v_mind >= 60:
$ bar_mind = 60
elif $ v_mind >= 40:
$ bar_mind = 40
elif $ v_mind >= 20:
$ bar_mind = 20
else:
$ v_mind = 0
The real question is, how do I do this in terms of a screen? Where do I put that code? I've tried putting it into the screen code, but it gives me an error, which is expected. Am I supposed to be doing something else?
Should I just make the bar a solid line instead of dots and avoid making it complicated?